[PATCH v4 0/6] Implement mdspan.

Luc Grosheintz luc.grosheintz@gmail.com
Wed Jul 16 14:00:41 GMT 2025



On 7/15/25 13:43, Tomasz Kaminski wrote:
> On Tue, Jul 15, 2025 at 1:35 PM Jonathan Wakely <jwakely@redhat.com> wrote:
> 
>> OK here are the details for all of the failing tests ...
>>
>> std/containers/views/mdspan/aligned_accessor/access.pass.cpp
>>
>> std/containers/views/mdspan/aligned_accessor/ctor.conversion.from.default_accessor.pass.cpp
>> std/containers/views/mdspan/aligned_accessor/ctor.conversion.pass.cpp
>> std/containers/views/mdspan/aligned_accessor/ctor.default.pass.cpp
>> std/containers/views/mdspan/aligned_accessor/offset.pass.cpp
>>
>> std/containers/views/mdspan/aligned_accessor/operator.conversion.to.default_accessor.pass.cpp
>> std/containers/views/mdspan/aligned_accessor/types.pass.cpp
>>
>> We don't support aligned_accessor yet.
>>
>> std/containers/views/mdspan/extents/ctor_from_array.pass.cpp
>> std/containers/views/mdspan/extents/ctor_from_span.pass.cpp
>>
>> These are both the same issue as Bug 121061:
>> static_assert(!std::is_constructible_v<std::dextents<int, 1>,
>> std::span<IntLike, 1>>);
>>
>> std/containers/views/mdspan/extents/dims.pass.cpp
>>
>> We don't support std:::dims
>>

Locally, this is ready. What's the PR number I should use? This is the
link to the paper:
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2389r2.html

>>
>> std/containers/views/mdspan/layout_stride/is_exhaustive_corner_case.pass.cpp
>>
>> Somebody needs to analyze this one.
>>
> This is most likely related to us implementing
> https://cplusplus.github.io/LWG/issue4266.
> 
>>
>> std/containers/views/mdspan/layout_stride/properties.pass.cpp
>>
>> This looks similar, is_always_exhaustive() is giving the wrong answer
>> in some case.
>>
>> std/containers/views/mdspan/mdspan/ctor.default.pass.cpp
>>
>> This is checking for a noexcept default ctor.
>>
>> std/containers/views/mdspan/mdspan/ctor.dh_array.pass.cpp
>> std/containers/views/mdspan/mdspan/ctor.dh_span.pass.cpp
>>
>> These are Bug 121061

I've submitted patches for this here:
https://gcc.gnu.org/pipermail/libstdc++/2025-July/062612.html

>>
>> std/containers/views/mdspan/mdspan/index_operator.pass.cpp
>>
>> Dunno what's happening here:
>>
>> std/containers/views/mdspan/mdspan/index_operator.pass.cpp:178:46:
>> in 'constexpr' expansion of
>> 'check_operator_constraints<std::mdspan<int, std::extents<i
>> nt, 18446744073709551615>, std::layout_left,
>> std::default_accessor<int> >, std::array<IntConfig<false, true, true,
>> true>, 1> >(std::mdspan<int, std::extents
>> <int, 18446744073709551615>, std::layout_left,
>> std::default_accessor<int> >(((int*)(& data)),
>> construct_mapping<std::extents<int, 18446744073709551615> >((s
>> td::layout_left(), std::layout_left()), std::extents<int,
>> 18446744073709551615>(1))), std::array<IntConfig<false, true, true,
>> true>, 1>{std::__array_traits<
>> IntConfig<false, true, true, true>, 1>::_Type{IntConfig<false, true,
>> true, true>{0}}})'
>> /home/jwakely/gcc/16/include/c++/16.0.0/mdspan:1234:25: error: no
>> match for 'operator[]' (operand types are 'const std::mdspan<int,
>> std::extents<int, 184467
>> 44073709551615>, std::layout_left, std::default_accessor<int> >' and
>> 'std::span<const IntConfig<false, true, true, true>, 1>')
>>
>  From docs:
> // IntConfig has configurable conversion properties: convert from const&,
> convert from non-const, no-throw-ctor from const&, no-throw-ctor from
> non-const
> This is again `_S_int_cast` not forwarding properly as noted in 121061.

This looks like it should also be fixed by the same
patch series mentioned above.

> 
>> 1234 |         { return (*this)[span<const _OIndexType,
>> rank()>(__indices)]; }
>>       |                  ~~~~~~~^
>>
>>
>> std/containers/views/mdspan/mdspan/properties.pass.cpp
>>
>> Many many failures like this:
>>
>> std/containers/views/mdspan/mdspan/properties.pass.cpp:146:17: error:
>> static assertion failed
>>   146 |   static_assert(noexcept(MDS::is_always_unique()));
>>       |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>
> These  are not noexcept in standard, so clang most likely made them
> conditionally noexcept.
> We could do the same.

I'll prepare patches for this.

> 
> std/containers/views/mdspan/mdspan/properties.pass.cpp:146:17: note:
>> 'false' evaluates to false
>> std/containers/views/mdspan/mdspan/properties.pass.cpp:147:17: error:
>> static assertion failed
>>   147 |   static_assert(noexcept(MDS::is_always_exhaustive()));
>>       |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> std/containers/views/mdspan/mdspan/properties.pass.cpp:147:17: note:
>> 'false' evaluates to false
>> std/containers/views/mdspan/mdspan/properties.pass.cpp:148:17: error:
>> static assertion failed
>>   148 |   static_assert(noexcept(MDS::is_always_strided()));
>>       |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>
>>
> 



More information about the Libstdc++ mailing list