Add template keyword to <mdspan> for Clang
Jonathan Wakely
jwakely@redhat.com
Mon Jul 7 10:31:54 GMT 2025
On Mon, 7 Jul 2025 at 07:53, Tomasz Kaminski <tkaminsk@redhat.com> wrote:
>
> Thanks.
> I am not sure if template is necessary here, as I believe this is type-only context, but I never understood the rules around this.
Same here. I remain unconvinced that relaxing the rules in the
standard was a good idea. "You always need it" was a lot easier to
understand than "you sometimes need it and even most members of the
standard committee aren't sure when you need it, probably safer to
just use it anyway".
>
> On Sat, Jul 5, 2025 at 1:15 AM Jonathan Wakely <jwakely@redhat.com> wrote:
>>
>> Clang wants this change:
>>
>> --- a/libstdc++-v3/include/std/mdspan
>> +++ b/libstdc++-v3/include/std/mdspan
>> @@ -509,7 +509,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>>
>> template<typename _Layout, typename _Mapping>
>> concept __mapping_of =
>> - is_same_v<typename _Layout::mapping<typename _Mapping::extents_type>,
>> + is_same_v<typename _Layout::template mapping<typename
>> _Mapping::extents_type>,
>> _Mapping>;
>>
>> template<typename _Mapping>
>>
>> to fix:
>>
>> /home/jwakely/gcc/latest/lib/gcc/x86_64-pc-linux-gnu/16.0.0/../../../../include/c++/16.0.0/mdspan:512:30:
>> error: use 'template' keyword to treat 'mapping' a
>> s a dependent template name
>> 512 | is_same_v<typename _Layout::mapping<typename
>> _Mapping::extents_type>,
>> | ^
>>
>>
>> I'll push that on Monday.
>>
More information about the Libstdc++
mailing list