aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/lex.c
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2017-01-20 14:36:46 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2017-01-20 14:36:46 +0000
commitebed71751b2c030de7f1ad9d284b54b34cfe0a20 (patch)
treee9e719aafb0644febd2b61d586b0ac4595d5db90 /gcc/cp/lex.c
parentd40036b846df9d07f679d593c55f0090f513bb24 (diff)
downloadgcc-ebed71751b2c030de7f1ad9d284b54b34cfe0a20.zip
gcc-ebed71751b2c030de7f1ad9d284b54b34cfe0a20.tar.gz
gcc-ebed71751b2c030de7f1ad9d284b54b34cfe0a20.tar.bz2
C++: fix fix-it hints for misspellings within explicit namespaces
gcc/cp/ChangeLog: PR c++/77829 PR c++/78656 * cp-tree.h (suggest_alternatives_for): Add bool param. (suggest_alternative_in_explicit_scope): New decl. * error.c (qualified_name_lookup_error): When SCOPE is a namespace that isn't the global one, call new function suggest_alternative_in_explicit_scope, only calling suggest_alternatives_for if it fails, and disabling near match searches fort that case. When SCOPE is the global namespace, pass true for new param to suggest_alternatives_for to allow for fuzzy name lookups. * lex.c (unqualified_name_lookup_error): Pass true for new param to suggest_alternatives_for. * name-lookup.c (consider_binding_level): Add forward decl. (suggest_alternatives_for): Add "suggest_misspellings" param, using it to conditionalize the fuzzy name-lookup code. (suggest_alternative_in_explicit_scope): New function. * parser.c (cp_parser_primary_expression): When calling finish_id_expression, pass location of id_expression rather than that of id_expr_token. (cp_parser_id_expression): Convert local "unqualified_id" from tree to cp_expr to avoid implicitly dropping location information. gcc/testsuite/ChangeLog: PR c++/77829 PR c++/78656 * g++.dg/spellcheck-pr77829.C: New test case. * g++.dg/spellcheck-pr78656.C: New test case. From-SVN: r244715
Diffstat (limited to 'gcc/cp/lex.c')
-rw-r--r--gcc/cp/lex.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c
index 797dd96..60a70e9 100644
--- a/gcc/cp/lex.c
+++ b/gcc/cp/lex.c
@@ -441,7 +441,7 @@ unqualified_name_lookup_error (tree name, location_t loc)
if (!objc_diagnose_private_ivar (name))
{
error_at (loc, "%qD was not declared in this scope", name);
- suggest_alternatives_for (loc, name);
+ suggest_alternatives_for (loc, name, true);
}
/* Prevent repeated error messages by creating a VAR_DECL with
this NAME in the innermost block scope. */