Skip to content

Commit

Permalink
Fixed build with GCC, Clang for standard C++17 and later
Browse files Browse the repository at this point in the history
Also CMAKE_CXX_STANDARD in workflow yml
  • Loading branch information
OleErikPeistorpet committed Sep 28, 2023
1 parent a75e32c commit 5bbe346
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 8 deletions.
34 changes: 31 additions & 3 deletions .github/workflows/cmake-multi-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,44 @@ jobs:
runs-on: ${{ matrix.os }}

strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
fail-fast: false
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations.
fail-fast: true

matrix:
os: [ubuntu-20.04, ubuntu-latest, macos-latest]
mem_bound_debug: [off, on]
cpp_standard: [17, 20]
mem_bound_debug: [off]
include:
- os: ubuntu-20.04
gcc_version: 7
cpp_standard: 17
mem_bound_debug: on
- os: ubuntu-20.04
gcc_version: 8
cpp_standard: 14
- os: ubuntu-20.04
gcc_version: 9
cpp_standard: 20
mem_bound_debug: on
- os: ubuntu-latest
gcc_version: 10
cpp_standard: 20
mem_bound_debug: on
- os: ubuntu-latest
gcc_version: 11
cpp_standard: 17
- os: ubuntu-latest
gcc_version: 12
cpp_standard: 20
- os: macos-latest
cpp_standard: 14
mem_bound_debug: on
exclude:
- os: ubuntu-20.04
cpp_standard: 20
mem_bound_debug: off
- os: macos-latest
cpp_standard: 17

steps:
- if: runner.os == 'Linux'
Expand All @@ -39,6 +66,7 @@ jobs:
run: >
cmake -B ${{ github.workspace }}/build
-D CMAKE_BUILD_TYPE=Release
-D CMAKE_CXX_STANDARD=${{ matrix.cpp_standard }}
-D MEM_BOUND_DEBUG=${{ matrix.mem_bound_debug }}
-S ${{ github.workspace }}/unit_test
Expand Down
2 changes: 1 addition & 1 deletion unit_test/view_gtest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ constexpr auto multBy2(StdArrInt2 a)
StdArrInt2 res{};
struct
{ constexpr auto operator()(int i) const { return 2 * i; }
} mult2;
} mult2{};
auto v = view::transform(a, mult2);
std::ptrdiff_t i{};
for (auto val : v)
Expand Down
4 changes: 2 additions & 2 deletions view/counted.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ class counted_view

constexpr bool empty() const noexcept { return 0 == _size; }

constexpr decltype(auto) operator[](difference_type index) const OEL_ALWAYS_INLINE
OEL_REQUIRES(iter_is_random_access<Iterator>) { return _begin[index]; }
constexpr decltype(auto) operator[](difference_type index) const
OEL_REQUIRES(iter_is_random_access<Iterator>) OEL_ALWAYS_INLINE { return _begin[index]; }

protected:
Iterator _begin;
Expand Down
4 changes: 2 additions & 2 deletions view/subrange.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ class basic_view

constexpr bool empty() const { return _begin == _end; }

constexpr decltype(auto) operator[](difference_type index) const OEL_ALWAYS_INLINE
OEL_REQUIRES(iter_is_random_access<Iterator>) { return _begin[index]; }
constexpr decltype(auto) operator[](difference_type index) const
OEL_REQUIRES(iter_is_random_access<Iterator>) OEL_ALWAYS_INLINE { return _begin[index]; }

protected:
Iterator _begin;
Expand Down

0 comments on commit 5bbe346

Please sign in to comment.