On Tue, 1 Dec 2026, 09:22 Tomasz Kaminski, <[email protected]> wrote:
> > > On Fri, Nov 27, 2026 at 10:57 PM Jonathan Wakely <[email protected]> > wrote: > >> This is needed to fix a -Wtemplate-names-tu-local warning from >> __simd_transform_reduce when compiling the std.cc module definition: >> >> include/pstl/unseq_backend_simd.h:453:1: warning: ‘template<[...]> [...] >> std::__onedpl::__unseq_backend::__simd_transform_reduce([...])’ refers to >> TU-local entity ‘std::__onedpl::__unseq_backend::__lane_size’, which may >> cause issues when instantiating in other TUs [-Wtemplate-names-tu-local] >> include/pstl/unseq_backend_simd.h:31:25: note: >> ‘std::__onedpl::__unseq_backend::__lane_size’ declared with internal linkage >> >> Making it an inline variable solves the problem, although maybe it would >> be better to use an enumerator or just an alias for a >> std::integral_constant. >> > consteval variables would also be useful for situations like this, as they > will not cause symbols to be emitted. > We need something that's valid in C++17 and works with clang, but we can use anything that meets those restrictions. We should report it upstream, and then maybe sync with however they fix it. I think inline constexpr variable is OK for now. > >> >> libstdc++-v3/ChangeLog: >> >> * include/pstl/unseq_backend_simd.h (__lane_size): Make an >> inline variable. >> --- >> >> Tested x86_64-linux. >> > LGTM > >> >> libstdc++-v3/include/pstl/unseq_backend_simd.h | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/libstdc++-v3/include/pstl/unseq_backend_simd.h >> b/libstdc++-v3/include/pstl/unseq_backend_simd.h >> index d120de205bec..3a7f53842e7f 100644 >> --- a/libstdc++-v3/include/pstl/unseq_backend_simd.h >> +++ b/libstdc++-v3/include/pstl/unseq_backend_simd.h >> @@ -28,7 +28,7 @@ namespace __unseq_backend >> { >> >> // Expect vector width up to 64 (or 512 bit) >> -const ::std::size_t __lane_size = 64; >> +inline constexpr ::std::size_t __lane_size = 64; >> >> template <typename _DifferenceType, typename _Function, typename... >> _Iterators> >> auto >> -- >> 2.56.1 >> >>
