[libstdc++-v3 patch] Fix invalid use of signed wchar_t and unsigned wchar_t in <type_traits>

Doug Gregor doug.gregor@gmail.com
Fri Jun 29 23:22:00 GMT 2007


IIRC, wchar_t cannot be marked signed or unsigned, but this is what
the C++0x type_traits header in libstdc++ is doing. The errors I'm
getting are:

In file included from
/Volumes/scratch/dgregor/gcc0x-install/lib/gcc/powerpc-apple-darwin8.9.0/4.3.0/../../../../include/c++/4.3.0/functional:66,
                 from /Volumes/scratch/dgregor/gcc0x/gcc/testsuite/g++.old-deja/
g++.other/headers1.C:30:
/Volumes/scratch/dgregor/gcc0x-install/lib/gcc/powerpc-apple-darwin8.9.0/4.3.0/../../../../include/c++/4.3.0/type_traits:361:
error: long, short, signed or unsigned used invalidly for '__type'
/Volumes/scratch/dgregor/gcc0x-install/lib/gcc/powerpc-apple-darwin8.9.0/4.3.0/../../../../include/c++/4.3.0/type_traits:440:
error: long, short, signed or unsigned used invalidly for '__type'

The fix is to remove those specializations. Patch follows. Tested on
cxx0x-branch (where it actually gets tested). Okay for mainline?

  - Doug

2007-06-29  Douglas Gregor  <doug.gregor@gmail.com>

        * include/std/type_traits (__make_unsigned): Remove invalid
        wchar_t specialization.
        (__make_signed): Remove invalid wchar_t specialization.


Index: include/std/type_traits
===================================================================
--- include/std/type_traits     (revision 126119)
+++ include/std/type_traits     (working copy)
@@ -357,10 +357,6 @@ namespace std
     { typedef unsigned char __type; };

   template<>
-    struct __make_unsigned<wchar_t>
-    { typedef unsigned wchar_t __type; };
-
-  template<>
     struct __make_unsigned<short>
     { typedef unsigned short __type; };

@@ -436,10 +432,6 @@ namespace std
     { typedef signed char __type; };

   template<>
-    struct __make_signed<wchar_t>
-    { typedef signed wchar_t __type; };
-
-  template<>
     struct __make_signed<unsigned short>
     { typedef signed short __type; };



More information about the Libstdc++ mailing list