------- Comment #2 from sje at cup dot hp dot com  2006-09-15 16:46 -------
I took a quick look at this bug, the fix is easy, I have included a patch I
created.  The problem is that there are 172 tests in the g++ and libstdc++
test suites that have empty enums in them.  If we give an error on empty enums
we will need to fix a lot of tests.

Patch:

Index: gcc/cp/parser.c
===================================================================
--- gcc/cp/parser.c     (revision 116960)
+++ gcc/cp/parser.c     (working copy)
@@ -10317,8 +10317,10 @@ cp_parser_enum_specifier (cp_parser* par
       return error_mark_node;
     }

-  /* If the next token is not '}', then there are some enumerators.  */
-  if (cp_lexer_next_token_is_not (parser->lexer, CPP_CLOSE_BRACE))
+  /* An empty enum is not allowed.  */
+  if (cp_lexer_next_token_is (parser->lexer, CPP_CLOSE_BRACE))
+    error ("an enum may not be empty");
+  else
     cp_parser_enumerator_list (parser, type);

   /* Consume the final '}'.  */


-- 

sje at cup dot hp dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sje at cup dot hp dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29018

Reply via email to