Message ID | 5188D669.1050402@oracle.com |
---|---|
State | New |
Headers | show |
On 05/07/2013 06:24 AM, Paolo Carlini wrote: > I'm not sure if it would be more correct to explicitly > cp_parser_abort_tentative_parse before returning Well, there needs to be something to match the cp_parser_parse_tentatively before this function returns. But in this case the code is indeed an enum-specifier, so I think it would be better to parse it as one rather than than return early. Jason
Index: cp/parser.c =================================================================== --- cp/parser.c (revision 198668) +++ cp/parser.c (working copy) @@ -14830,6 +14830,13 @@ cp_parser_enum_specifier (cp_parser* parser) /*type_p=*/false, /*is_declaration=*/false); + if (nested_name_specifier == error_mark_node) + { + /* We already issued an error. */ + pop_deferring_access_checks (); + goto out; + } + if (nested_name_specifier) { tree name; Index: testsuite/g++.dg/cpp0x/pr51226.C =================================================================== --- testsuite/g++.dg/cpp0x/pr51226.C (revision 0) +++ testsuite/g++.dg/cpp0x/pr51226.C (working copy) @@ -0,0 +1,9 @@ +// PR c++/51226 +// { dg-do compile { target c++11 } } + +template<int> struct A // { dg-error "provided" } +{ + enum E : int; +}; + +template<> enum A<>::E : int {} // { dg-error "wrong number" }