+2013-04-11 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/54216
+ * parser.c (cp_parser_enum_specifier): Check for empty
+ anonymous enums and anonymous scoped enums.
+
2013-04-10 Jakub Jelinek <jakub@redhat.com>
PR c++/56895
{
identifier = make_anon_name ();
is_anonymous = true;
+ if (scoped_enum_p)
+ error_at (type_start_token->location,
+ "anonymous scoped enum is not allowed");
}
}
pop_deferring_access_checks ();
if (type == error_mark_node)
cp_parser_skip_to_end_of_block_or_statement (parser);
/* If the next token is not '}', then there are some enumerators. */
- else if (cp_lexer_next_token_is_not (parser->lexer, CPP_CLOSE_BRACE))
+ else if (cp_lexer_next_token_is (parser->lexer, CPP_CLOSE_BRACE))
+ {
+ if (is_anonymous && !scoped_enum_p)
+ pedwarn (type_start_token->location, OPT_Wpedantic,
+ "ISO C++ forbids empty anonymous enum");
+ }
+ else
cp_parser_enumerator_list (parser, type);
/* Consume the final '}'. */
+2013-04-11 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/54216
+ * g++.dg/cpp0x/enum26.C: New.
+ * g++.old-deja/g++.pt/mangle1.C: Adjust.
+
2013-04-11 James Greenhalgh <james.greenhalgh@arm.com>
* gcc.target/aarch64/vect-fcm.x: Add check for zero forms of
--- /dev/null
+// PR c++/54216
+// { dg-options "-std=c++11 -pedantic" }
+
+enum {}; // { dg-warning "empty anonymous" }
+
+enum class {}; // { dg-error "anonymous" }
+
+enum class { x }; // { dg-error "anonymous" }