From: Luc Grosheintz Date: Wed, 19 Nov 2025 13:52:04 +0000 (+0100) Subject: libstdc++: Make compatible with clang. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=58b88748e6bf651d425ae11d143d02a29575186b;p=thirdparty%2Fgcc.git libstdc++: Make compatible with clang. These three changes are needed to make compatible with Clang: - the type alias _Storage must occur before its first use. - the friend declarations of function must match exactly, including noexcept and constexpr. - the 'template' in typename T::template type. libstdc++-v3/ChangeLog: * include/std/mdspan (extents::_Storage): Move type alias before its first use. (__mdspan::__static_extents): Add missing noexcept and constexpr to friend declaration in extents. (__mdspan::__dynamic_extents): Ditto. Reviewed-by: Jonathan Wakely Signed-off-by: Luc Grosheintz --- diff --git a/libstdc++-v3/include/std/mdspan b/libstdc++-v3/include/std/mdspan index d555b7f2580..bd7a2a201a7 100644 --- a/libstdc++-v3/include/std/mdspan +++ b/libstdc++-v3/include/std/mdspan @@ -378,6 +378,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION static_assert( (__mdspan::__valid_static_extent<_Extents, _IndexType> && ...), "Extents must either be dynamic or representable as IndexType"); + + using _Storage = __mdspan::_ExtentsStorage< + _IndexType, array{_Extents...}>; + [[no_unique_address]] _Storage _M_exts; + public: using index_type = _IndexType; using size_type = make_unsigned_t; @@ -487,15 +492,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } private: - friend const array& - __mdspan::__static_extents(); + friend constexpr const array& + __mdspan::__static_extents() noexcept; - friend span - __mdspan::__dynamic_extents(const extents&, size_t, size_t); - - using _Storage = __mdspan::_ExtentsStorage< - _IndexType, array{_Extents...}>; - [[no_unique_address]] _Storage _M_exts; + friend constexpr span + __mdspan::__dynamic_extents(const extents&, size_t, size_t) + noexcept; template friend class extents; @@ -1637,8 +1639,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template constexpr explicit - _PaddedStorage(const typename _LayoutSame::mapping<_OExtents>& - __other) + _PaddedStorage( + const typename _LayoutSame::template mapping<_OExtents>& __other) : _PaddedStorage(_Extents(__other.extents())) { constexpr size_t __stride_idx = _LayoutTraits::_S_stride_idx;