diff mbox

[C++] PR 57673

Message ID 51F8E1A8.7000808@oracle.com
State New
Headers show

Commit Message

Paolo Carlini July 31, 2013, 10:06 a.m. UTC
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.

////////////////////////

Comments

Jason Merrill July 31, 2013, 6:20 p.m. UTC | #1
OK.

Jason
diff mbox

Patch

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;