From 9d9d6b6346eed217087d92e17ff46ef04853de63 Mon Sep 17 00:00:00 2001 From: Jakub Mazurkiewicz Date: Tue, 18 Nov 2025 17:05:07 +0100 Subject: [PATCH 1/3] Implement LWG-4272: `layout_left`'s constructor --- stl/inc/mdspan | 2 +- tests/std/tests/P0009R18_mdspan_layout_left/test.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/stl/inc/mdspan b/stl/inc/mdspan index 4e890a97fe5..8b37c377571 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 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>>); } } From 781805a10a181524f6bd010c36208d5b20ac15ec Mon Sep 17 00:00:00 2001 From: Jakub Mazurkiewicz Date: Tue, 18 Nov 2025 17:05:34 +0100 Subject: [PATCH 2/3] Implement LWG-4272: `layout_right`'s constructor --- stl/inc/mdspan | 3 ++- tests/std/tests/P0009R18_mdspan_layout_right/test.cpp | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/stl/inc/mdspan b/stl/inc/mdspan index 8b37c377571..962dc9b9aaa 100644 --- a/stl/inc/mdspan +++ b/stl/inc/mdspan @@ -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/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>>); } } From cf9fc995f4edef1367dce5c7c4742b1f00f85d05 Mon Sep 17 00:00:00 2001 From: Jakub Mazurkiewicz Date: Wed, 19 Nov 2025 13:30:55 +0100 Subject: [PATCH 3/3] Update libc++ tests --- tests/libcxx/expected_results.txt | 4 ++++ 1 file changed, 4 insertions(+) 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