(finish_enum): Disable code which forces enums to be signed,
authorJason Merrill <merrill@gnu.org>
Sat, 15 Oct 1994 00:32:58 +0000 (00:32 +0000)
committerJason Merrill <merrill@gnu.org>
Sat, 15 Oct 1994 00:32:58 +0000 (00:32 +0000)
        since this conflicts with their use as bitfields. type_promotes_to
        handles promotion of enums of underlying unsigned types to signed
        integer types.

From-SVN: r8279

gcc/cp/decl.c

index b6b4f89d6577390a3ded0b963a3b38f8a4aa756e..d4e04f05f5183ea0a2dfe3399a1a98fe97eb4011 100644 (file)
@@ -10282,9 +10282,20 @@ finish_enum (enumtype, values)
     if (! flag_short_enums && precision < TYPE_PRECISION (integer_type_node))
       precision = TYPE_PRECISION (integer_type_node);
 
+
+    /*
+     *  The following code is unnecessary since the function 
+     *  type_promotes_to deals correctly with promotion of enums of 
+     *  underlying unsigned types to signed integer types.
+     *  Moreover, it causes an enum bitfield to require one more bit of
+     *  storage than defined by the ANSI/ISO C++ resolution section r.7.2
+     *  which defines the range of an enum. 
+     */
+#if 0
     /* Unlike the C frontend, we prefer signed types.  */
     if (unsignedp && int_fits_type_p (maxnode, type_for_size (precision, 0)))
       unsignedp = 0;
+#endif
 
     TYPE_PRECISION (enumtype) = precision;
     TYPE_SIZE (enumtype) = NULL_TREE;