[PATCH] libstdc++: Add more template keywords to <mdspan> for Clang

Jonathan Wakely jwakely@redhat.com
Tue Jul 8 21:31:51 GMT 2025


This fixes:

include/c++/16.0.0/mdspan:1182:33: error: use 'template' keyword to treat 'mapping' as a dependent template name
 1182 |               const typename _OLayout::mapping<_OExtents>&>
      |                                        ^
include/c++/16.0.0/mdspan:1185:31: error: use 'template' keyword to treat 'mapping' as a dependent template name
 1185 |             const typename _OLayout::mapping<_OExtents>&, mapping_type>
      |                                      ^

libstdc++-v3/ChangeLog:

	* include/std/mdspan (mdspan): Add template keyword for
	dependent name.
---

Tested x86_64-linux.

 libstdc++-v3/include/std/mdspan | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/include/std/mdspan b/libstdc++-v3/include/std/mdspan
index 5d16de5d9072..b34116a85e67 100644
--- a/libstdc++-v3/include/std/mdspan
+++ b/libstdc++-v3/include/std/mdspan
@@ -1179,10 +1179,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       template<typename _OElementType, typename _OExtents, typename _OLayout,
 	       typename _OAccessor>
 	requires is_constructible_v<mapping_type,
-	      const typename _OLayout::mapping<_OExtents>&>
+	      const typename _OLayout::template mapping<_OExtents>&>
 	  && is_constructible_v<accessor_type, const _OAccessor&>
 	constexpr explicit(!is_convertible_v<
-	    const typename _OLayout::mapping<_OExtents>&, mapping_type>
+	    const typename _OLayout::template mapping<_OExtents>&, mapping_type>
 	  || !is_convertible_v<const _OAccessor&, accessor_type>)
 	mdspan(const mdspan<_OElementType, _OExtents, _OLayout, _OAccessor>&
 		 __other)
-- 
2.50.0



More information about the Libstdc++ mailing list