[Bug c++/96077] GCC accepts ill-legal local enum definition

mpolacek at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jul 9 21:40:22 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96077

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |mpolacek at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
We probably need to commit like this to get errors:

--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -19412,7 +19412,10 @@ cp_parser_enum_specifier (cp_parser* parser)
             "ISO C++ forbids empty unnamed enum");
    }
       else
-   cp_parser_enumerator_list (parser, type);
+   {
+     cp_parser_commit_to_tentative_parse (parser);
+     cp_parser_enumerator_list (parser, type);
+   }

       /* Consume the final '}'.  */
       braces.require_close (parser);


More information about the Gcc-bugs mailing list