diff --git a/stl/inc/mdspan b/stl/inc/mdspan index 4e890a97fe5..962dc9b9aaa 100644 --- a/stl/inc/mdspan +++ b/stl/inc/mdspan @@ -538,7 +538,7 @@ public: template requires is_constructible_v - constexpr explicit(extents_type::rank() > 0) + constexpr explicit(!(extents_type::rank() == 0 && is_convertible_v<_OtherExtents, extents_type>) ) mapping(const layout_stride::mapping<_OtherExtents>& _Other) noexcept // strengthened : _Base(_Other.extents()) { #if _ITERATOR_DEBUG_LEVEL != 0 @@ -693,7 +693,8 @@ public: template requires is_constructible_v - constexpr explicit(extents_type::rank() > 0) mapping(const layout_stride::mapping<_OtherExtents>& _Other) noexcept + constexpr explicit(!(extents_type::rank() == 0 && is_convertible_v<_OtherExtents, extents_type>) ) + mapping(const layout_stride::mapping<_OtherExtents>& _Other) noexcept : _Base(_Other.extents()) { #if _ITERATOR_DEBUG_LEVEL != 0 if constexpr (extents_type::rank() > 0) { diff --git a/tests/libcxx/expected_results.txt b/tests/libcxx/expected_results.txt index 23dcd2bbca2..63ed5f7291b 100644 --- a/tests/libcxx/expected_results.txt +++ b/tests/libcxx/expected_results.txt @@ -185,6 +185,10 @@ std/ranges/range.adaptors/range.join/range.join.iterator/arrow.pass.cpp FAIL std/containers/views/mdspan/layout_stride/is_exhaustive_corner_case.pass.cpp FAIL std/containers/views/mdspan/layout_stride/properties.pass.cpp FAIL +# libc++ doesn't implement LWG-4272 "For `rank == 0`, `layout_stride` is atypically convertible" +std/containers/views/mdspan/layout_left/ctor.layout_stride.pass.cpp FAIL +std/containers/views/mdspan/layout_right/ctor.layout_stride.pass.cpp FAIL + # If any feature-test macro test is failing, this consolidated test will also fail. std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp FAIL diff --git a/tests/std/tests/P0009R18_mdspan_layout_left/test.cpp b/tests/std/tests/P0009R18_mdspan_layout_left/test.cpp index 90d00be88b7..55a285b66a0 100644 --- a/tests/std/tests/P0009R18_mdspan_layout_left/test.cpp +++ b/tests/std/tests/P0009R18_mdspan_layout_left/test.cpp @@ -293,6 +293,8 @@ constexpr void check_construction_from_other_stride_mapping() { layout_stride::mapping>>); static_assert(NotImplicitlyConstructibleFrom>, layout_stride::mapping>>); + static_assert(NotImplicitlyConstructibleFrom>, + layout_stride::mapping>>); } } diff --git a/tests/std/tests/P0009R18_mdspan_layout_right/test.cpp b/tests/std/tests/P0009R18_mdspan_layout_right/test.cpp index fa3679ff03f..8702d2f600e 100644 --- a/tests/std/tests/P0009R18_mdspan_layout_right/test.cpp +++ b/tests/std/tests/P0009R18_mdspan_layout_right/test.cpp @@ -292,6 +292,8 @@ constexpr void check_construction_from_other_stride_mapping() { layout_stride::mapping>>); static_assert(NotImplicitlyConstructibleFrom>, layout_stride::mapping>>); + static_assert(NotImplicitlyConstructibleFrom>, + layout_stride::mapping>>); } }