2010-09-15 Jason Merrill <jason@redhat.com>
+ * decl2.c (grokbitfield): Diagnose non-integral width.
+
* call.c (convert_like_real): Use the underlying type of the
reference for the temporary.
if (width != error_mark_node)
{
+ /* The width must be an integer type. */
+ if (!INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (TREE_TYPE (width)))
+ error ("width of bit-field %qD has non-integral type %qT", value,
+ TREE_TYPE (width));
constant_expression_warning (width);
DECL_INITIAL (value) = width;
SET_DECL_C_BIT_FIELD (value);
+2010-09-15 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/cpp0x/scoped_enum2.C: New.
+
2010-09-15 Eric Botcazou <ebotcazou@adacore.com>
* gcc.c-torture/compile/20100915-1.c: New test.
--- /dev/null
+// { dg-options -std=c++0x }
+
+enum class E { e = 10 };
+enum E2 { e2 = 10 };
+
+struct C {
+ int arr[E::e]; // { dg-error "non-integral type" }
+ int arr2[E2::e2]; // OK
+ int i: E::e; // { dg-error "non-integral type" }
+ int i2: E2::e2; // OK
+};