From 8328f29e7b6682fb5ba83be951b5ed0a360bb465 Mon Sep 17 00:00:00 2001 From: Christian Trott Date: Mon, 23 Oct 2023 12:57:17 -0600 Subject: [PATCH] Fix layout_stride convertibility --- compilation_tests/ctest_layout_convertible.cpp | 4 +++- include/experimental/__p0009_bits/layout_stride.hpp | 8 ++++---- .../layout_stride.ctor.strided_mapping.pass.cpp | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/compilation_tests/ctest_layout_convertible.cpp b/compilation_tests/ctest_layout_convertible.cpp index 8f866fce..2da8b84e 100644 --- a/compilation_tests/ctest_layout_convertible.cpp +++ b/compilation_tests/ctest_layout_convertible.cpp @@ -80,10 +80,12 @@ MDSPAN_STATIC_TEST( !std::is_convertible::mapping, LS1>::value ); +#if !MDSPAN_HAS_CXX_14 && !MDSPAN_HAS_CXX_20 MDSPAN_STATIC_TEST( std::is_constructible::mapping>::value && - std::is_convertible::mapping, LS2>::value + !std::is_convertible::mapping, LS2>::value ); +#endif MDSPAN_STATIC_TEST( !std::is_constructible>::value diff --git a/include/experimental/__p0009_bits/layout_stride.hpp b/include/experimental/__p0009_bits/layout_stride.hpp index 4883f07b..ffb8054a 100644 --- a/include/experimental/__p0009_bits/layout_stride.hpp +++ b/include/experimental/__p0009_bits/layout_stride.hpp @@ -363,10 +363,10 @@ struct layout_stride { ) #endif MDSPAN_CONDITIONAL_EXPLICIT( - (!std::is_convertible::value) && - (detail::__is_mapping_of || - detail::__is_mapping_of || - detail::__is_mapping_of) + !(std::is_convertible::value && + (detail::__is_mapping_of || + detail::__is_mapping_of || + detail::__is_mapping_of)) ) // needs two () due to comma MDSPAN_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 mapping(StridedLayoutMapping const& other) noexcept // NOLINT(google-explicit-constructor) diff --git a/tests/libcxx-backports/layout_stride/layout_stride.ctor.strided_mapping.pass.cpp b/tests/libcxx-backports/layout_stride/layout_stride.ctor.strided_mapping.pass.cpp index c044b96e..7772cbe2 100644 --- a/tests/libcxx-backports/layout_stride/layout_stride.ctor.strided_mapping.pass.cpp +++ b/tests/libcxx-backports/layout_stride/layout_stride.ctor.strided_mapping.pass.cpp @@ -182,7 +182,7 @@ constexpr bool test() { test_layout(); test_layout(); test_layout(); - //test_layout(); //FIXME + test_layout(); return true; }