diff options
author | Nathan Froyd <froydnj@codesourcery.com> | 2010-12-14 20:31:22 +0000 |
---|---|---|
committer | Nathan Froyd <froydnj@gcc.gnu.org> | 2010-12-14 20:31:22 +0000 |
commit | 993acb366ebf8a43f66669950b385710eba931cb (patch) | |
tree | a3f1edf7efd982b0735aec9f5727133cb89fece1 /gcc/cp/name-lookup.c | |
parent | ec047df48239928a1776c10e7e5f11c76c6974a5 (diff) | |
download | gcc-993acb366ebf8a43f66669950b385710eba931cb.zip gcc-993acb366ebf8a43f66669950b385710eba931cb.tar.gz gcc-993acb366ebf8a43f66669950b385710eba931cb.tar.bz2 |
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
Diffstat (limited to 'gcc/cp/name-lookup.c')
-rw-r--r-- | gcc/cp/name-lookup.c | 9 |
1 files changed, 3 insertions, 6 deletions
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:"); |