aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/lex.c
diff options
context:
space:
mode:
authorNathan Froyd <froydnj@codesourcery.com>2010-12-07 13:46:29 +0000
committerNathan Froyd <froydnj@gcc.gnu.org>2010-12-07 13:46:29 +0000
commit501c95ff0546ff1d2632017c6f66fc0cd83566f7 (patch)
treefe63f288d7fac2d1492b5370bcf38c201cc58251 /gcc/cp/lex.c
parent85a47bed9340d25f861b9e2a186a4d443660cc26 (diff)
downloadgcc-501c95ff0546ff1d2632017c6f66fc0cd83566f7.zip
gcc-501c95ff0546ff1d2632017c6f66fc0cd83566f7.tar.gz
gcc-501c95ff0546ff1d2632017c6f66fc0cd83566f7.tar.bz2
re PR c++/45330 (Suggest likely nested-name-specifiers for undeclared identifiers.)
gcc/ PR c++/45330 * params.def (CXX_MAX_NAMESPACES_FOR_DIAGNOSTIC_HELP): New parameter. * doc/invoke.texi (cxx-max-namespaces-for-diagnostic-help): Document. gcc/cp/ PR c++/45330 * cp-tree.h (suggest_alternatives_for, location_of): Declare. * error.c (dump_expr): Handle TYPE_DECL. (location_of): Unstaticize. * name-lookup.c (suggest_alternatives_for): New function. * lex.c (unqualified_name_lookup_error): Call it. gcc/testsuite/ PR c++/45330 * g++.dg/pr45330.C: New test. * g++.dg/ext/builtin3.C: Adjust. * g++.dg/lookup/error1.C: Adjust. * g++.dg/lookup/koenig5.C: Adjust. * g++.dg/overload/koenig1.C: Adjust. * g++.dg/parse/decl-specifier-1.C: Adjust. * g++.dg/template/static10.C: Adjust. * g++.old-deja/g++.mike/ns5.C: Adjust. * g++.old-deja/g++.mike/ns7.C: Adjust. * g++.old-deja/g++.ns/koenig5.C: Adjust. * g++.old-deja/g++.ns/koenig9.C: Adjust. * g++.old-deja/g++.other/lineno5.C: Adjust. From-SVN: r167536
Diffstat (limited to 'gcc/cp/lex.c')
-rw-r--r--gcc/cp/lex.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c
index 684803f..5a2ae41 100644
--- a/gcc/cp/lex.c
+++ b/gcc/cp/lex.c
@@ -450,7 +450,10 @@ unqualified_name_lookup_error (tree name)
else
{
if (!objc_diagnose_private_ivar (name))
- error ("%qD was not declared in this scope", name);
+ {
+ error ("%qD was not declared in this scope", name);
+ suggest_alternatives_for (name);
+ }
/* Prevent repeated error messages by creating a VAR_DECL with
this NAME in the innermost block scope. */
if (current_function_decl)