[PATCH v1] libstdc++: Add _GLIBCXX_RESOLVE_LIB_DEFECTS for 4314 in <mdspan>.

Luc Grosheintz luc.grosheintz@gmail.com
Wed Sep 3 15:28:27 GMT 2025


In r16-2328-g29d53f6213e0a1 we fixed a bug related to user-defined
objects that can convert to an integers only via an rvalue reference.
The same commit also implemented LWG 4314 [1], but didn't mark it with
_GLIBCXX_RESOLVE_LIB_DEFECTS. This commit adds the missing markers.

[1]: https://cplusplus.github.io/LWG/issue4314

It also fixes one cases of trailing white-space near a ctor for
aligned_accessor.

libstdc++-v3/ChangeLog:

	* include/std/mdspan (layout_left::mapping::operator()): Add
	_GLIBCXX_RESOLVE_LIB_DEFECTS marker for 4314.
	(layout_left::mapping::operator()): Ditto.
	(layout_stride::mapping::operator()): Ditto.

Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
---
 libstdc++-v3/include/std/mdspan | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libstdc++-v3/include/std/mdspan b/libstdc++-v3/include/std/mdspan
index 6c7469cd2d8..678b2619ebe 100644
--- a/libstdc++-v3/include/std/mdspan
+++ b/libstdc++-v3/include/std/mdspan
@@ -727,6 +727,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       required_span_size() const noexcept
       { return __mdspan::__size(_M_extents); }
 
+      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+      // 4314. Missing move in mdspan layout mapping::operator()
       template<__mdspan::__valid_index_type<index_type>... _Indices>
 	requires (sizeof...(_Indices) == extents_type::rank())
 	constexpr index_type
@@ -866,6 +868,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       required_span_size() const noexcept
       { return __mdspan::__size(_M_extents); }
 
+      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+      // 4314. Missing move in mdspan layout mapping::operator()
       template<__mdspan::__valid_index_type<index_type>... _Indices>
 	requires (sizeof...(_Indices) == extents_type::rank())
 	constexpr index_type
@@ -1089,6 +1093,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	return __ret;
       }
 
+      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+      // 4314. Missing move in mdspan layout mapping::operator()
       template<__mdspan::__valid_index_type<index_type>... _Indices>
 	requires (sizeof...(_Indices) == extents_type::rank())
 	constexpr index_type
@@ -1208,7 +1214,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       aligned_accessor() noexcept = default;
 
       template<typename _OElementType, size_t _OByteAlignment>
-	requires (_OByteAlignment >= byte_alignment) 
+	requires (_OByteAlignment >= byte_alignment)
 	    && is_convertible_v<_OElementType(*)[], element_type(*)[]>
 	constexpr
 	aligned_accessor(aligned_accessor<_OElementType, _OByteAlignment>)
-- 
2.51.0



More information about the Libstdc++ mailing list