* decl2.c (grokbitfield): Diagnose non-integral width.
From-SVN: r164321
This commit is contained in:
parent
02a39a93ce
commit
441b624e3d
|
@ -1,5 +1,7 @@
|
||||||
2010-09-15 Jason Merrill <jason@redhat.com>
|
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
|
* call.c (convert_like_real): Use the underlying type of the
|
||||||
reference for the temporary.
|
reference for the temporary.
|
||||||
|
|
||||||
|
|
|
@ -1066,6 +1066,10 @@ grokbitfield (const cp_declarator *declarator,
|
||||||
|
|
||||||
if (width != error_mark_node)
|
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);
|
constant_expression_warning (width);
|
||||||
DECL_INITIAL (value) = width;
|
DECL_INITIAL (value) = width;
|
||||||
SET_DECL_C_BIT_FIELD (value);
|
SET_DECL_C_BIT_FIELD (value);
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
2010-09-15 Jason Merrill <jason@redhat.com>
|
||||||
|
|
||||||
|
* g++.dg/cpp0x/scoped_enum2.C: New.
|
||||||
|
|
||||||
2010-09-15 Eric Botcazou <ebotcazou@adacore.com>
|
2010-09-15 Eric Botcazou <ebotcazou@adacore.com>
|
||||||
|
|
||||||
* gcc.c-torture/compile/20100915-1.c: New test.
|
* gcc.c-torture/compile/20100915-1.c: New test.
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
// { 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
|
||||||
|
};
|
Loading…
Reference in New Issue