+2009-08-31 Jason Merrill <jason@redhat.com>
+
+ PR c++/41127
+ * parser.c (cp_parser_enum_specifier): Make sure the : is followed by a
+ type-specifier-seq before we commit.
+
2009-08-28 Richard Guenther <rguenther@suse.de>
PR lto/41058
else
identifier = make_anon_name ();
- /* Check for the `:' that denotes a specified underlying type in C++0x. */
+ /* Check for the `:' that denotes a specified underlying type in C++0x.
+ Note that a ':' could also indicate a bitfield width, however. */
if (cp_lexer_next_token_is (parser->lexer, CPP_COLON))
{
cp_decl_specifier_seq type_specifiers;
+ /* Consume the `:'. */
+ cp_lexer_consume_token (parser->lexer);
+
+ /* Parse the type-specifier-seq. */
+ cp_parser_type_specifier_seq (parser, /*is_condition=*/false,
+ &type_specifiers);
+
/* At this point this is surely not elaborated type specifier. */
if (!cp_parser_parse_definitely (parser))
return NULL_TREE;
if (cxx_dialect == cxx98)
maybe_warn_cpp0x ("scoped enums");
- /* Consume the `:'. */
- cp_lexer_consume_token (parser->lexer);
-
has_underlying_type = true;
- /* Parse the type-specifier-seq. */
- cp_parser_type_specifier_seq (parser, /*is_condition=*/false,
- &type_specifiers);
-
/* If that didn't work, stop. */
if (type_specifiers.type != error_mark_node)
{
+2009-08-31 Jason Merrill <jason@redhat.com>
+
+ PR c++/41127
+ * g++.dg/parse/enum5.C: New.
+ * g++.dg/cpp0x/enum1.C: Adjust expected error.
+
2009-08-31 Janus Weil <janus@gcc.gnu.org>
PR fortran/40940
--- /dev/null
+// PR c++/41127
+
+#define CHAR_BIT 8
+enum EE {ee};
+typedef unsigned int T;
+
+struct D {
+ T : sizeof(unsigned int) * CHAR_BIT; // OK
+ EE : sizeof(EE) * CHAR_BIT; // OK
+ enum EE : sizeof(EE) * CHAR_BIT; // not OK
+ enum EE xxxx : sizeof(EE) * CHAR_BIT; // OK
+ T x : sizeof(unsigned int) * CHAR_BIT; // OK
+ enum FF {ff} : sizeof(int) * CHAR_BIT; // OK
+} element;
+
+enum EE xx;
+EE yy;