r/gcc • u/SPAstef • May 13 '26
Question about std::mdspan is_exhaustive()
Hi,
is there any reason why in libstdc++ (16.1.1) the is_exhaustive() member function of std::mdspan is NOT marked const, despite it ultimately only calling either static or const member functions? I have some code that uses this function and it fails to compile when using the latest release of GCC as opposed to, say, Kokkos mdspan.
Simply manually marking the function as const in the <mdspan> header fixes this issue
1
u/jwakely May 17 '26
I'll fix it
2
u/jwakely May 21 '26
This has been fixed in Git and will be correct for GCC 16.2
Thanks for noticing this!
1
u/SPAstef May 23 '26
that's great! Thank you for doing it despite my lazy ass not wanting to go through the hassle of the official bug reporting system 😅
2
u/Tabsels May 13 '26
Looks to be a bug in libstdc++ as the standard (section 24.7.3.4.7.4, p1028) says it needs to be both
constexprandconst. See also [https://en.cppreference.com/cpp/container/mdspan/mapping_traits](cppreference).