[C++ Patch] PR 57673

Paolo Carlini paolo.carlini@oracle.com
Wed Jul 31 10:14:00 GMT 2013


On 07/30/2013 09:36 PM, Jason Merrill wrote:
> OK.
Thanks, installed.

Today I had a look to the error recovery in cp_parser_sizeof_pack and 
noticed a few cases in which we could do better. A very simple issue is 
the following: when cp_parser_identifier returns error_mark_node we 
don't notice and we get to cp_parser_lookup_name_simple. Then it's 
pretty easy to have error messages with a final redundant:

   error: ‘<expression error>’ has not been declared

The below passes testing.

Thanks,
Paolo.

////////////////////////
-------------- next part --------------
Index: parser.c
===================================================================
--- parser.c	(revision 201363)
+++ parser.c	(working copy)
@@ -23140,6 +23140,8 @@ cp_parser_sizeof_pack (cp_parser *parser)
 
   cp_token *token = cp_lexer_peek_token (parser->lexer);
   tree name = cp_parser_identifier (parser);
+  if (name == error_mark_node)
+    return error_mark_node;
   /* The name is not qualified.  */
   parser->scope = NULL_TREE;
   parser->qualifying_scope = NULL_TREE;


More information about the Gcc-patches mailing list