]> gcc.gnu.org Git - gcc.git/commit
libstdc++: Define type traits for wchar_t even when libc support missing
authorJonathan Wakely <jwakely@redhat.com>
Sun, 1 Nov 2020 10:56:36 +0000 (10:56 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Sun, 1 Nov 2020 11:39:07 +0000 (11:39 +0000)
commit29e418485848c4a6943d8561cd8fb0b1abf14015
treea407e74705910515e38c711a08313bfb0b3d5551
parentde77abee118f1900fceb25c34b0cc1ef7261c9ce
libstdc++: Define type traits for wchar_t even when libc support missing

This meets the requirement that std::is_integral_v<wchar_t> is true,
even when full library support for wchar_t via specializations of
char_traits etc. is not provided. This is done by checking
__WCHAR_TYPE__ to see if the compiler knows about the type, rather than
checking the library's own _GLIBCXX_USE_WCHAR_T autoconf macro.

This assumes that the C++ compiler correctly defines wchar_t as a
distinct type, not a typedef for one of the other integeral types. This
is always true for G++ and should be true for any supported non-GNU
compilers.

Similarly, the std::make_unsigned and std::make_signed traits and the
internal helpers std::__is_integer and std::__is_char are also changed
to depend on the same macro.

libstdc++-v3/ChangeLog:

* include/std/type_traits (is_integral<wchar_t>)
(make_unsigned<wchar_t>, make_signed<wchar_t>): Define based
on #ifdef __WCHAR_TYPE__ instead of _GLIBCXX_USE_WCHAR_T.
* include/bits/cpp_type_traits.h (__is_integer<wchar_t>)
(__is_char<wchar_t>): Likewise.
libstdc++-v3/include/bits/cpp_type_traits.h
libstdc++-v3/include/std/type_traits
This page took 0.056624 seconds and 5 git commands to generate.