From 993acb366ebf8a43f66669950b385710eba931cb Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Tue, 14 Dec 2010 20:31:22 +0000 Subject: re PR c++/45330 (Suggest likely nested-name-specifiers for undeclared identifiers.) gcc/cp/ PR c++/45330 * cp-tree.h (suggest_alternatives_for): Add location_t parameter. * name-lookup.c (suggest_alternatives_for): Likewise. Adjust. * lex.c (unqualified_name_lookup_error): Adjust call to it. * semantics.c (qualified_name_lookup_error): Move to... * error.c (qualified_name_lookup_error): ...here. Call. suggest_alternatives_for. gcc/testsuite/ PR c++/45330 * g++.dg/lookup/suggestions1.C: New test. From-SVN: r167814 --- gcc/cp/name-lookup.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'gcc/cp/name-lookup.c') diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 4cf1380..e2e5450 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -3923,7 +3923,7 @@ remove_hidden_names (tree fns) possible candidates. */ void -suggest_alternatives_for (tree name) +suggest_alternatives_for (location_t location, tree name) { VEC(tree,heap) *candidates = NULL; VEC(tree,heap) *namespaces_to_search = NULL; @@ -3931,7 +3931,6 @@ suggest_alternatives_for (tree name) int n_searched = 0; tree t; unsigned ix; - location_t name_location; VEC_safe_push (tree, heap, namespaces_to_search, global_namespace); @@ -3955,15 +3954,13 @@ suggest_alternatives_for (tree name) VEC_safe_push (tree, heap, namespaces_to_search, t); } - name_location = location_of (name); - /* If we stopped before we could examine all namespaces, inform the user. Do this even if we don't have any candidates, since there might be more candidates further down that we weren't able to find. */ if (n_searched >= max_to_search && !VEC_empty (tree, namespaces_to_search)) - inform (name_location, + inform (location, "maximum limit of %d namespaces searched for %qE", max_to_search, name); @@ -3973,7 +3970,7 @@ suggest_alternatives_for (tree name) if (VEC_empty (tree, candidates)) return; - inform_n (name_location, VEC_length (tree, candidates), + inform_n (location, VEC_length (tree, candidates), "suggested alternative:", "suggested alternatives:"); -- cgit v1.1