These variable templates give warnings in C++11 mode when -Wsystem-headers is used:
In file included from /home/jwakely/gcc/7/include/c++/7.0.0/memory:77:0, from vt.cc:1: /home/jwakely/gcc/7/include/c++/7.0.0/bits/uses_allocator.h:130:20: warning: variable templates only available with -std=c++14 or -std=gnu++14 constexpr bool __is_uses_allocator_constructible_v = ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/jwakely/gcc/7/include/c++/7.0.0/bits/uses_allocator.h:141:20: warning: variable templates only available with -std=c++14 or -std=gnu++14 constexpr bool __is_nothrow_uses_allocator_constructible_v = ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ We don't need them, so let's only define them for C++14 and up. * include/bits/uses_allocator.h (__is_uses_allocator_constructible_v) (__is_nothrow_uses_allocator_constructible_v): Only define for C++14 and later. Tested powerpc64le-linux, committed to trunk.
commit b19fd14727318d5d6f3a411a2a600f89d07ab28a Author: Jonathan Wakely <jwak...@redhat.com> Date: Tue Oct 18 12:31:11 2016 +0100 Don't define uses-allocator variable templates in C++11 * include/bits/uses_allocator.h (__is_uses_allocator_constructible_v) (__is_nothrow_uses_allocator_constructible_v): Only define for C++14 and later. diff --git a/libstdc++-v3/include/bits/uses_allocator.h b/libstdc++-v3/include/bits/uses_allocator.h index c7d14f3..612c53c 100644 --- a/libstdc++-v3/include/bits/uses_allocator.h +++ b/libstdc++-v3/include/bits/uses_allocator.h @@ -126,9 +126,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : __is_uses_allocator_predicate<is_constructible, _Tp, _Alloc, _Args...> { }; +#if __cplusplus >= 201402L template<typename _Tp, typename _Alloc, typename... _Args> constexpr bool __is_uses_allocator_constructible_v = __is_uses_allocator_constructible<_Tp, _Alloc, _Args...>::value; +#endif // C++14 template<typename _Tp, typename _Alloc, typename... _Args> struct __is_nothrow_uses_allocator_constructible @@ -137,9 +139,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { }; +#if __cplusplus >= 201402L template<typename _Tp, typename _Alloc, typename... _Args> constexpr bool __is_nothrow_uses_allocator_constructible_v = __is_nothrow_uses_allocator_constructible<_Tp, _Alloc, _Args...>::value; +#endif // C++14 template<typename _Tp, typename... _Args> void __uses_allocator_construct_impl(__uses_alloc0 __a, _Tp* __ptr,