aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r--gcc/cp/parser.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 05151cd..2672f15 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -3632,10 +3632,17 @@ cp_parser_nested_name_specifier_opt (cp_parser *parser,
{
/* Grab the nested-name-specifier and continue the loop. */
cp_parser_pre_parsed_nested_name_specifier (parser);
+ /* If we originally encountered this nested-name-specifier
+ with IS_DECLARATION set to false, we will not have
+ resolved TYPENAME_TYPEs, so we must do so here. */
if (is_declaration
&& TREE_CODE (parser->scope) == TYPENAME_TYPE)
- parser->scope = resolve_typename_type (parser->scope,
- /*only_current_p=*/false);
+ {
+ new_scope = resolve_typename_type (parser->scope,
+ /*only_current_p=*/false);
+ if (new_scope != error_mark_node)
+ parser->scope = new_scope;
+ }
success = true;
continue;
}