Skip to content

Commit

Permalink
Fix regression in GCC 11 (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
mingxwa authored Apr 17, 2024
1 parent c8f0b6b commit 60ecacd
Show file tree
Hide file tree
Showing 8 changed files with 157 additions and 92 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/bvt-clang.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
on:
workflow_call:
inputs:
branch:
type: string
required: false

jobs:
bvt-clang:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.branch }}

- name: install clang
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-add-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main" -y
sudo apt-add-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main" -y
sudo apt-add-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main" -y
sudo apt-add-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main" -y
sudo apt update
sudo apt install -y clang-15 clang-16 clang-17 clang-18
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/clang-15 1
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/clang++-15 1
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/clang-16 1
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/clang++-16 1
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/clang-17 1
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/clang++-17 1
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/clang-18 1
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/clang++-18 1
- name: check compiler versions
run: |
clang++-15 --version
clang++-16 --version
clang++-17 --version
clang++-18 --version
- name: build and run test with clang 15
run: |
sudo update-alternatives --set gcc /usr/bin/clang-15
sudo update-alternatives --set g++ /usr/bin/clang++-15
cmake . -B build-clang-15
cmake --build ./build-clang-15 -j8
cd ./build-clang-15
ctest -j8
- name: build and run test with clang 16
run: |
sudo update-alternatives --set gcc /usr/bin/clang-16
sudo update-alternatives --set g++ /usr/bin/clang++-16
cmake . -B build-clang-16
cmake --build ./build-clang-16 -j8
cd ./build-clang-16
ctest -j8
- name: build and run test with clang 17
run: |
sudo update-alternatives --set gcc /usr/bin/clang-17
sudo update-alternatives --set g++ /usr/bin/clang++-17
cmake . -B build-clang-17
cmake --build ./build-clang-17 -j8
cd ./build-clang-17
ctest -j8
- name: build and run test with clang 18
run: |
sudo update-alternatives --set gcc /usr/bin/clang-18
sudo update-alternatives --set g++ /usr/bin/clang++-18
cmake . -B build-clang-18
cmake --build ./build-clang-18 -j8
cd ./build-clang-18
ctest -j8
36 changes: 0 additions & 36 deletions .github/workflows/bvt-clang15.yml

This file was deleted.

58 changes: 58 additions & 0 deletions .github/workflows/bvt-gcc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
on:
workflow_call:
inputs:
branch:
type: string
required: false

jobs:
bvt-gcc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.branch }}

- name: install gcc
run: |
sudo apt update
sudo apt install -y gcc-11 g++-11 gcc-12 g++-12 gcc-13 g++-13
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 1
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 1
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 1
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 1
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 1
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 1
- name: check compiler versions
run: |
g++-11 --version
g++-12 --version
g++-13 --version
- name: build and run test with gcc 11
run: |
sudo update-alternatives --set gcc /usr/bin/gcc-11
sudo update-alternatives --set g++ /usr/bin/g++-11
cmake . -B build-gcc-11
cmake --build ./build-gcc-11 -j8
cd ./build-gcc-11
ctest -j8
- name: build and run test with gcc 12
run: |
sudo update-alternatives --set gcc /usr/bin/gcc-12
sudo update-alternatives --set g++ /usr/bin/g++-12
cmake . -B build-gcc-12
cmake --build ./build-gcc-12 -j8
cd ./build-gcc-12
ctest -j8
- name: build and run test with gcc 13
run: |
sudo update-alternatives --set gcc /usr/bin/gcc-13
sudo update-alternatives --set g++ /usr/bin/g++-13
cmake . -B build-gcc-13
cmake --build ./build-gcc-13 -j8
cd ./build-gcc-13
ctest -j8
34 changes: 0 additions & 34 deletions .github/workflows/bvt-gcc13.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
required: false

jobs:
bvt-msvc14:
bvt-msvc:
runs-on: windows-2022
steps:
- uses: actions/checkout@v3
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/pipeline-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ env:
BUILD_TYPE: Release

jobs:
run-bvt-gcc13:
uses: ./.github/workflows/bvt-gcc13.yml
name: run bvt with g++ 13
run-bvt-gcc:
uses: ./.github/workflows/bvt-gcc.yml
name: run bvt with g++

run-bvt-clang15:
uses: ./.github/workflows/bvt-clang15.yml
name: run bvt with clang 15
run-bvt-clang:
uses: ./.github/workflows/bvt-clang.yml
name: run bvt with clang

run-bvt-msvc14:
uses: ./.github/workflows/bvt-msvc14.yml
name: run bvt with msvc14 (vs2022)
run-bvt-msvc:
uses: ./.github/workflows/bvt-msvc.yml
name: run bvt with msvc
20 changes: 10 additions & 10 deletions .github/workflows/pipeline-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,30 +37,30 @@ jobs:
git push origin release/${{ github.event.inputs.version }}
git push origin ${{ github.event.inputs.version }}
run-bvt-gcc13:
run-bvt-gcc:
needs: prepare-release
name: run bvt with g++ 13
uses: ./.github/workflows/bvt-gcc13.yml
name: run bvt with g++
uses: ./.github/workflows/bvt-gcc.yml
with:
branch: release/${{ github.event.inputs.version }}

run-bvt-clang15:
run-bvt-clang:
needs: prepare-release
name: run bvt with clang 15
uses: ./.github/workflows/bvt-clang15.yml
name: run bvt with clang
uses: ./.github/workflows/bvt-clang.yml
with:
branch: release/${{ github.event.inputs.version }}

run-bvt-msvc14:
run-bvt-msvc:
needs: prepare-release
name: run bvt with msvc14 (vs2022)
uses: ./.github/workflows/bvt-msvc14.yml
name: run bvt with msvc
uses: ./.github/workflows/bvt-msvc.yml
with:
branch: release/${{ github.event.inputs.version }}

draft-release:
runs-on: windows-latest
needs: [run-bvt-gcc11, run-bvt-clang14, run-bvt-msvc14]
needs: [run-bvt-gcc, run-bvt-clang, run-bvt-msvc]
steps:
- uses: actions/checkout@v3
with:
Expand Down
6 changes: 4 additions & 2 deletions proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,16 @@ template <class Expr>
consteval bool is_consteval(Expr)
{ return requires { typename std::bool_constant<(Expr{}(), false)>; }; }

template <class T, std::size_t I>
concept has_tuple_element = requires { typename std::tuple_element_t<I, T>; };
template <class T>
consteval bool is_tuple_like_well_formed() {
if constexpr (requires { { std::tuple_size<T>::value } ->
std::same_as<const std::size_t&>; }) {
if constexpr (is_consteval([] { return std::tuple_size<T>::value; })) {
return []<std::size_t... I>(std::index_sequence<I...>) {
return (requires { typename std::tuple_element_t<I, T>; } && ...);
}(std::make_index_sequence<std::tuple_size_v<T>>{});
return (has_tuple_element<T, I> && ...);
}(std::make_index_sequence<std::tuple_size_v<T>>{});
}
}
return false;
Expand Down

0 comments on commit 60ecacd

Please sign in to comment.