Skip to content

Commit

Permalink
Added C++ 20 to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Drew Hubley committed Jul 7, 2024
1 parent 8c0a484 commit 1f92286
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
- {os: ubuntu-22.04, compiler: gcc, version: '12', name: c++17, flags: -DCPP17=ON}
- {os: ubuntu-22.04, compiler: gcc, version: '12', name: xsimd-tbb, flags: -DXTENSOR_USE_XSIMD=ON -DXTENSOR_USE_TBB=ON}
- {os: ubuntu-22.04, compiler: gcc, version: '12', name: tbb, flags: -DXTENSOR_USE_TBB=ON -DTBB_INCLUDE_DIR=$CONDA_PREFIX/include -DTBB_LIBRARY=$CONDA_PREFIX/lib}
- {os: ubuntu-22.04, compiler: gcc, version: '12', name: c++20, flags: -DCPP20=ON}
runs-on: ${{ matrix.sys.os }}
steps:
- name: Setup GCC
Expand Down
2 changes: 1 addition & 1 deletion include/xtensor/xutils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ namespace xt
using base_type::deallocate;

// Construct and destroy are removed in --std=c++-20
#if ((defined(__cplusplus) && __cplusplus < 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG < 202002L))
#if (__cplusplus < 202002L && !defined(_MSVC_LANG)) || (defined(_MSVC_LANG) && _MSVC_LANG < 202002L)
using base_type::construct;
using base_type::destroy;
#endif
Expand Down
10 changes: 6 additions & 4 deletions test/test_xdynamic_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ namespace xt
auto nas2 = nau.convert<std::ptrdiff_t>();
EXPECT_EQ(nas2, nas);

xkeep_slice<std::ptrdiff_t> ks({2, 3, -1});
auto keep_index = {2, 3, -1};
xkeep_slice<std::ptrdiff_t> ks(keep_index);
ks.normalize(6);
xkeep_slice<std::size_t> ku(ks);
EXPECT_EQ(ku.size(), std::size_t(3));
Expand All @@ -227,9 +228,10 @@ namespace xt
EXPECT_TRUE(ku.contains(5));

auto ks2 = ku.convert<std::size_t>();
EXPECT_EQ(ks2, ks);
EXPECT_EQ(ks2, xkeep_slice<std::size_t>(keep_index));

xdrop_slice<std::ptrdiff_t> ds({2, 3, -1});
auto drop_index = {2, 3, -1};
xdrop_slice<std::ptrdiff_t> ds(drop_index);
ds.normalize(6);
xdrop_slice<std::size_t> du(ds);
EXPECT_EQ(du.size(), std::size_t(3));
Expand All @@ -241,7 +243,7 @@ namespace xt
EXPECT_FALSE(du.contains(5));

auto ds2 = du.convert<std::size_t>();
EXPECT_EQ(ds2, ds);
EXPECT_EQ(ds2, xdrop_slice<std::size_t>(drop_index));
}

TEST(xdynamic_view, compilation_linux_issue_1349)
Expand Down

0 comments on commit 1f92286

Please sign in to comment.