[Bug libstdc++/85951] make_signed and make_unsigned are incorrect for wchar_t, char16_t, and char32_t

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu May 31 14:08:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85951

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Thu May 31 14:07:22 2018
New Revision: 261024

URL: https://gcc.gnu.org/viewcvs?rev=261024&root=gcc&view=rev
Log:
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.

        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<char16_t>, __make_unsigned<char32_t>): Define.
        (__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.

Modified:
    branches/gcc-8-branch/libstdc++-v3/ChangeLog
    branches/gcc-8-branch/libstdc++-v3/include/std/type_traits
   
branches/gcc-8-branch/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-3.cc
   
branches/gcc-8-branch/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc
   
branches/gcc-8-branch/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-3.cc
   
branches/gcc-8-branch/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc


More information about the Gcc-bugs mailing list