From: Nathan Sidwell Date: Tue, 6 Jun 2017 23:02:49 +0000 (+0000) Subject: name-lookup.c (suggest_alternatives_for): Use qualified lookup sans using directives. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=25396db9caa179fb2e50199a9b72d579dde3e68b;p=gcc.git 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 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 8200756ba4d..8375ceedd49 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2017-06-06 Nathan Sidwell + * 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. diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 169a1c99eda..6ed164d4645 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -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 ()) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 74c974c1919..bd12c4786f4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2017-06-06 Nathan Sidwell + + * g++.dg/pr45330.C: Add inline namespace case. + 2017-06-06 Thomas Koenig PR fortran/80975 diff --git a/gcc/testsuite/g++.dg/pr45330.C b/gcc/testsuite/g++.dg/pr45330.C index 54b245be6ec..f16094d93f1 100644 --- a/gcc/testsuite/g++.dg/pr45330.C +++ b/gcc/testsuite/g++.dg/pr45330.C @@ -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