summaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorLuc Grosheintz <luc.grosheintz@gmail.com>2025-11-19 14:52:04 +0100
committerTomasz KamiƄski <tkaminsk@redhat.com>2025-11-19 15:47:11 +0100
commit58b88748e6bf651d425ae11d143d02a29575186b (patch)
tree83e68a6994427fae7def249f4b76a58eb944005f /libstdc++-v3
parent3027010d8bcc854eb43425cb1da573ff7345a5ac (diff)
libstdc++: Make <mdspan> compatible with clang.
These three changes are needed to make <mdspan> 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<double>. 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 <jwakely@redhat.com> Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/include/std/mdspan22
1 files changed, 12 insertions, 10 deletions
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<size_t, sizeof...(_Extents)>{_Extents...}>;
+ [[no_unique_address]] _Storage _M_exts;
+
public:
using index_type = _IndexType;
using size_type = make_unsigned_t<index_type>;
@@ -487,15 +492,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
private:
- friend const array<size_t, rank()>&
- __mdspan::__static_extents<extents>();
+ friend constexpr const array<size_t, rank()>&
+ __mdspan::__static_extents<extents>() noexcept;
- friend span<const index_type>
- __mdspan::__dynamic_extents<extents>(const extents&, size_t, size_t);
-
- using _Storage = __mdspan::_ExtentsStorage<
- _IndexType, array<size_t, sizeof...(_Extents)>{_Extents...}>;
- [[no_unique_address]] _Storage _M_exts;
+ friend constexpr span<const index_type>
+ __mdspan::__dynamic_extents<extents>(const extents&, size_t, size_t)
+ noexcept;
template<typename _OIndexType, size_t... _OExtents>
friend class extents;
@@ -1637,8 +1639,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _OExtents>
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;