Index: gcc/testsuite/g++.dg/cpp0x/enum21a.C =================================================================== --- gcc/testsuite/g++.dg/cpp0x/enum21a.C (revision 0) +++ gcc/testsuite/g++.dg/cpp0x/enum21a.C (revision 0) @@ -0,0 +1,4 @@ +// { dg-do compile } +// { dg-options "-pedantic" } + +enum x { y, }; // { dg-warning "comma at end of enumerator list" } Index: gcc/testsuite/g++.dg/cpp0x/enum21b.C =================================================================== --- gcc/testsuite/g++.dg/cpp0x/enum21b.C (revision 0) +++ gcc/testsuite/g++.dg/cpp0x/enum21b.C (revision 0) @@ -0,0 +1,4 @@ +// { dg-do compile } +// { dg-options "-pedantic -std=c++0x" } + +enum x { y, }; Index: gcc/cp/parser.c =================================================================== --- gcc/cp/parser.c (revision 179711) +++ gcc/cp/parser.c (working copy) @@ -13444,6 +13444,7 @@ cp_parser_elaborated_type_specifier (cp_parser* pa enum-specifier: enum-head { enumerator-list [opt] } + enum-head { enumerator-list , } [C++0x] enum-head: enum-key identifier [opt] enum-base [opt] @@ -13463,6 +13464,8 @@ cp_parser_elaborated_type_specifier (cp_parser* pa GNU Extensions: enum-key attributes[opt] identifier [opt] enum-base [opt] { enumerator-list [opt] }attributes[opt] + enum-key attributes[opt] identifier [opt] enum-base [opt] + { enumerator-list, }attributes[opt] [C++0x] Returns an ENUM_TYPE representing the enumeration, or NULL_TREE if the token stream isn't an enum-specifier after all. */ @@ -13802,8 +13805,9 @@ cp_parser_enumerator_list (cp_parser* parser, tree /* If the next token is a `}', there is a trailing comma. */ if (cp_lexer_next_token_is (parser->lexer, CPP_CLOSE_BRACE)) { - if (!in_system_header) - pedwarn (input_location, OPT_pedantic, "comma at end of enumerator list"); + if (cxx_dialect < cxx0x && !in_system_header) + pedwarn (input_location, OPT_pedantic, + "comma at end of enumerator list"); break; } }