From 01c53a74cd594131d9b066eb3036c6245562dc41 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 23 Aug 2019 19:29:10 -0400 Subject: [PATCH] * parser.c (cp_parser_nested_name_specifier_opt): Avoid redundant error. From-SVN: r274893 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/parser.c | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 8eebf894f45..06437559480 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2019-08-22 Jason Merrill + + * parser.c (cp_parser_nested_name_specifier_opt): Avoid redundant + error. + 2019-08-23 Marek Polacek PR c++/91521 - wrong error with operator->. diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 53514787554..382575320de 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -6420,9 +6420,11 @@ cp_parser_nested_name_specifier_opt (cp_parser *parser, == CPP_SCOPE)) { token = cp_lexer_consume_token (parser->lexer); - error_at (token->location, "% evaluates to %qT, " - "which is not a class or enumeration type", - token->u.tree_check_value->value); + tree dtype = token->u.tree_check_value->value; + if (dtype != error_mark_node) + error_at (token->location, "% evaluates to %qT, " + "which is not a class or enumeration type", + dtype); parser->scope = error_mark_node; error_p = true; /* As below. */ -- 2.30.2