summaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/parser.c12
2 files changed, 16 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 5a13125e513..2714cd3e9bb 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2014-05-16 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/51640
+ * parser.c (cp_parser_diagnose_invalid_type_name): Early return
+ when cp_parser_lookup_name sets ambiguous_decls.
+
2014-05-15 Jason Merrill <jason@redhat.com>
* call.c (print_conversion_rejection): Use loc consistently.
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index dae4393d6e2..7d9f81d314f 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -2880,13 +2880,21 @@ cp_parser_diagnose_invalid_type_name (cp_parser *parser,
tree scope, tree id,
location_t location)
{
- tree decl, old_scope;
+ tree decl, old_scope, ambiguous_decls;
cp_parser_commit_to_tentative_parse (parser);
/* Try to lookup the identifier. */
old_scope = parser->scope;
parser->scope = scope;
- decl = cp_parser_lookup_name_simple (parser, id, location);
+ decl = cp_parser_lookup_name (parser, id, none_type,
+ /*is_template=*/false,
+ /*is_namespace=*/false,
+ /*check_dependency=*/true,
+ &ambiguous_decls, location);
parser->scope = old_scope;
+ if (ambiguous_decls)
+ /* If the lookup was ambiguous, an error will already have
+ been issued. */
+ return;
/* If the lookup found a template-name, it means that the user forgot
to specify an argument list. Emit a useful error message. */
if (TREE_CODE (decl) == TEMPLATE_DECL)