Commit 25396db9 by Nathan Sidwell Committed by Nathan Sidwell

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
parent f788537d
2017-06-06 Nathan Sidwell <nathan@acm.org> 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 PR c++/80979
* name-lookup.c (adl_class_only): Don't add visible friends. * name-lookup.c (adl_class_only): Don't add visible friends.
......
...@@ -4714,9 +4714,10 @@ suggest_alternatives_for (location_t location, tree name, ...@@ -4714,9 +4714,10 @@ suggest_alternatives_for (location_t location, tree name,
for (unsigned ix = 0; ix != worklist.length (); ix++) for (unsigned ix = 0; ix != worklist.length (); ix++)
{ {
tree ns = worklist[ix]; tree ns = worklist[ix];
name_lookup lookup (name);
if (tree value = ovl_skip_hidden (find_namespace_value (ns, name))) if (lookup.search_qualified (ns, false))
candidates.safe_push (value); candidates.safe_push (lookup.value);
if (!limited) if (!limited)
{ {
...@@ -4728,7 +4729,8 @@ suggest_alternatives_for (location_t location, tree name, ...@@ -4728,7 +4729,8 @@ suggest_alternatives_for (location_t location, tree name,
for (tree decl = NAMESPACE_LEVEL (ns)->names; for (tree decl = NAMESPACE_LEVEL (ns)->names;
decl; decl = TREE_CHAIN (decl)) decl; decl = TREE_CHAIN (decl))
if (TREE_CODE (decl) == NAMESPACE_DECL if (TREE_CODE (decl) == NAMESPACE_DECL
&& !DECL_NAMESPACE_ALIAS (decl)) && !DECL_NAMESPACE_ALIAS (decl)
&& !DECL_NAMESPACE_INLINE_P (decl))
children.safe_push (decl); children.safe_push (decl);
while (!limited && !children.is_empty ()) while (!limited && !children.is_empty ())
......
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> 2017-06-06 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/80975 PR fortran/80975
......
// { dg-do compile } // { dg-do compile { target c++11 } }
// Search std, __cxxabiv1, and global namespaces, plus two more, // Search std, __cxxabiv1, and global namespaces, plus two more,
// breadth first // breadth first
...@@ -17,7 +17,10 @@ namespace A ...@@ -17,7 +17,10 @@ namespace A
namespace B namespace B
{ {
int foo; // { dg-message "B::foo" "suggested alternative" } inline namespace I
{
int foo; // { dg-message "B::I::foo" "suggested alternative" }
}
} }
namespace C namespace C
......
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