[Bug c++/78656] Fix-it suggestion for std::alocator doesn't include std::allocator
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78656 David Malcolm changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED --- Comment #4 from David Malcolm --- Should be fixed by r244715; marking as resolved.
[Bug c++/78656] Fix-it suggestion for std::alocator doesn't include std::allocator
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78656 --- Comment #3 from David Malcolm --- Author: dmalcolm Date: Fri Jan 20 14:36:46 2017 New Revision: 244715 URL: https://gcc.gnu.org/viewcvs?rev=244715&root=gcc&view=rev Log: 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. Added: trunk/gcc/testsuite/g++.dg/spellcheck-pr77829.C trunk/gcc/testsuite/g++.dg/spellcheck-pr78656.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/cp-tree.h trunk/gcc/cp/error.c trunk/gcc/cp/lex.c trunk/gcc/cp/name-lookup.c trunk/gcc/cp/parser.c trunk/gcc/testsuite/ChangeLog
[Bug c++/78656] Fix-it suggestion for std::alocator doesn't include std::allocator
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78656 --- Comment #2 from David Malcolm --- Candidate patch: https://gcc.gnu.org/ml/gcc-patches/2017-01/msg00143.html
[Bug c++/78656] Fix-it suggestion for std::alocator doesn't include std::allocator
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78656 David Malcolm changed: What|Removed |Added Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |dmalcolm at gcc dot gnu.org
[Bug c++/78656] Fix-it suggestion for std::alocator doesn't include std::allocator
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78656 David Malcolm changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2016-12-13 Ever confirmed|0 |1 --- Comment #1 from David Malcolm --- Confirmed. Error is emitted here: 3767 else if (scope != global_namespace) 3768{ 3769 error_at (location, "%qD is not a member of %qD", name, scope); 3770 suggest_alternatives_for (location, name); 3771} (gdb) p scope $1 = (gdb) p name $2 = Note that suggest_alternatives_for doesn't receive "scope" as a parameter. "suggest_alternatives_for" looks through namespaces, starting in global namespace and reports on any exact matches. It only uses the near-match code if no exact matches are found, and even then, it only looks in the global namespace. Presumably if the namespace was given explicitly, then we want to look for near matches in that namespace.