PR libstdc++/85951 for make_signed/make_unsigned for character types
commit4767eb54d222cce81988ccf66105a245c58be79a
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 31 May 2018 12:18:19 +0000 (31 12:18 +0000)
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 31 May 2018 12:18:19 +0000 (31 12:18 +0000)
treecd22aba21544238369a50a0a80152a5203283080
parente4ef299081a8a23960a20afc300c3aa46e62e034
PR libstdc++/85951 for make_signed/make_unsigned for character types

Because the wide character types are neither signed integer types nor
unsigned integer types they need to be transformed to an integral type
of the correct size and the lowest rank (which is not necessarily the
underlying type). Reuse the helpers for enumeration types to select the
correct integer.

The refactoring of __make_unsigned_selector and __make_signed_selector
slightly reduces the number of template instantiations and so reduces
memory usage.

PR libstdc++/85951
* include/std/type_traits [_GLIBCXX_USE_C99_STDINT_TR1]: Do not define
uint_least16_t and uint_least32_t.
(__make_unsigned<wchar_t>): Define unconditionally.
(__make_unsigned_selector<_Tp, true, false>): Remove intermediate
typedefs.
(__make_unsigned_selector_base): New type to provide helper templates.
(__make_unsigned_selector<_Tp, false, true>): Reimplement using
__make_unsigned_selector_base helpers.
(__make_unsigned<char16_t>, __make_unsigned<char32_t>): Define.
(__make_signed_selector<_Tp, true, false>): Remove intermediate
typedefs.
(__make_signed<wchar_t>, __make_signed<char16_t>)
(__make_signed<char32_t>)): Define unconditionally.
* testsuite/20_util/make_signed/requirements/typedefs-3.cc: Check
wchar_t, char16_t and char32_t are transformed correctly.
* testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Adjust
dg-error lineno.
* testsuite/20_util/make_unsigned/requirements/typedefs-3.cc: Check
wchar_t, char16_t and char32_t are transformed correctly.
* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Adjust
dg-error lineno.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@261023 138bc75d-0d04-0410-961f-82ee72b054a4
libstdc++-v3/ChangeLog
libstdc++-v3/include/std/type_traits
libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-3.cc
libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc
libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-3.cc
libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc