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

2018-06-04 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85951

Jonathan Wakely  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |8.2

--- Comment #5 from Jonathan Wakely  ---
Fixed for 8.2

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

2018-05-31 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85951

--- Comment #4 from Jonathan Wakely  ---
Fixed for trunk and 8.2 so far.

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

2018-05-31 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85951

--- Comment #3 from Jonathan Wakely  ---
Author: redi
Date: Thu May 31 14:07:22 2018
New Revision: 261024

URL: https://gcc.gnu.org/viewcvs?rev=261024=gcc=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): Define unconditionally.
(__make_unsigned, __make_unsigned): Define.
(__make_signed, __make_signed)
(__make_signed)): 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

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

2018-05-31 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85951

--- Comment #2 from Jonathan Wakely  ---
Author: redi
Date: Thu May 31 12:18:19 2018
New Revision: 261023

URL: https://gcc.gnu.org/viewcvs?rev=261023=gcc=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.

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): 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, __make_unsigned): Define.
(__make_signed_selector<_Tp, true, false>): Remove intermediate
typedefs.
(__make_signed, __make_signed)
(__make_signed)): 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:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/include/std/type_traits
trunk/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-3.cc
   
trunk/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc
   
trunk/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-3.cc
   
trunk/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc

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

2018-05-28 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85951

Jonathan Wakely  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2018-05-28
   Assignee|unassigned at gcc dot gnu.org  |redi at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Jonathan Wakely  ---
I thought I'd fixed this, but my fix for PR 60326 was just wrong.