Commit fcb2cdfc by David Malcolm Committed by David Malcolm

Fix ICE with spelling hints within explicit namespace aliases (PR c++/79298)

gcc/cp/ChangeLog:
	PR c++/79298
	* name-lookup.c (suggest_alternative_in_explicit_scope): Resolve
	any namespace aliases.

gcc/testsuite/ChangeLog:
	PR c++/79298
	* g++.dg/spellcheck-pr79298.C: New test case.

From-SVN: r245072
parent 7cfa044d
2017-01-31 David Malcolm <dmalcolm@redhat.com>
PR c++/79298
* name-lookup.c (suggest_alternative_in_explicit_scope): Resolve
any namespace aliases.
2017-01-31 Nathan Sidwell <nathan@acm.org> 2017-01-31 Nathan Sidwell <nathan@acm.org>
PR c++/79290 PR c++/79290
......
...@@ -4545,6 +4545,9 @@ bool ...@@ -4545,6 +4545,9 @@ bool
suggest_alternative_in_explicit_scope (location_t location, tree name, suggest_alternative_in_explicit_scope (location_t location, tree name,
tree scope) tree scope)
{ {
/* Resolve any namespace aliases. */
scope = ORIGINAL_NAMESPACE (scope);
cp_binding_level *level = NAMESPACE_LEVEL (scope); cp_binding_level *level = NAMESPACE_LEVEL (scope);
best_match <tree, tree> bm (name); best_match <tree, tree> bm (name);
......
2017-01-31 David Malcolm <dmalcolm@redhat.com> 2017-01-31 David Malcolm <dmalcolm@redhat.com>
PR c++/79298
* g++.dg/spellcheck-pr79298.C: New test case.
2017-01-31 David Malcolm <dmalcolm@redhat.com>
PR preprocessor/79210 PR preprocessor/79210
* gcc.dg/format/pr79210.c: New test case. * gcc.dg/format/pr79210.c: New test case.
* gcc.dg/plugin/diagnostic-test-string-literals-2.c (test_pr79210): * gcc.dg/plugin/diagnostic-test-string-literals-2.c (test_pr79210):
......
// Ensure that we can offer suggestions for misspellings via a
// namespace alias.
namespace N { int x; int color; }
namespace M = N;
namespace O = M;
int foo ()
{
return M::y; // { dg-error ".y. is not a member of .M." }
}
int bar ()
{
return O::colour; // { dg-error ".colour. is not a member of .O." }
// { dg-message "suggested alternative: .color." "" { target *-*-* } .-1 }
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment