name-lookup.c (suggest_alternatives_for): Use qualified lookup sans using directives.

* name-lookup.c (suggest_alternatives_for): Use qualified lookup
	sans using directives.  Don't walk into inline namespaces.

	* g++.dg/pr45330.C: Add inline namespace case.

From-SVN: r248938
This commit is contained in:
Nathan Sidwell 2017-06-06 23:02:49 +00:00 committed by Nathan Sidwell
parent f788537d68
commit 25396db9ca
4 changed files with 17 additions and 5 deletions

View File

@ -1,5 +1,8 @@
2017-06-06 Nathan Sidwell <nathan@acm.org>
* name-lookup.c (suggest_alternatives_for): Use qualified lookup
sans using directives. Don't walk into inline namespaces.
PR c++/80979
* name-lookup.c (adl_class_only): Don't add visible friends.

View File

@ -4714,9 +4714,10 @@ suggest_alternatives_for (location_t location, tree name,
for (unsigned ix = 0; ix != worklist.length (); ix++)
{
tree ns = worklist[ix];
name_lookup lookup (name);
if (tree value = ovl_skip_hidden (find_namespace_value (ns, name)))
candidates.safe_push (value);
if (lookup.search_qualified (ns, false))
candidates.safe_push (lookup.value);
if (!limited)
{
@ -4728,7 +4729,8 @@ suggest_alternatives_for (location_t location, tree name,
for (tree decl = NAMESPACE_LEVEL (ns)->names;
decl; decl = TREE_CHAIN (decl))
if (TREE_CODE (decl) == NAMESPACE_DECL
&& !DECL_NAMESPACE_ALIAS (decl))
&& !DECL_NAMESPACE_ALIAS (decl)
&& !DECL_NAMESPACE_INLINE_P (decl))
children.safe_push (decl);
while (!limited && !children.is_empty ())

View File

@ -1,3 +1,7 @@
2017-06-06 Nathan Sidwell <nathan@acm.org>
* g++.dg/pr45330.C: Add inline namespace case.
2017-06-06 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/80975

View File

@ -1,4 +1,4 @@
// { dg-do compile }
// { dg-do compile { target c++11 } }
// Search std, __cxxabiv1, and global namespaces, plus two more,
// breadth first
@ -17,7 +17,10 @@ namespace A
namespace B
{
int foo; // { dg-message "B::foo" "suggested alternative" }
inline namespace I
{
int foo; // { dg-message "B::I::foo" "suggested alternative" }
}
}
namespace C