diff options
author | Nathan Sidwell <nathan@acm.org> | 2017-06-06 23:02:49 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2017-06-06 23:02:49 +0000 |
commit | 25396db9caa179fb2e50199a9b72d579dde3e68b (patch) | |
tree | 5dd0dec0b426a37b2a5a4b4ba15119df9c4d4ead | |
parent | f788537d682b78a5496276da4e35c8462317175f (diff) | |
download | gcc-25396db9caa179fb2e50199a9b72d579dde3e68b.zip gcc-25396db9caa179fb2e50199a9b72d579dde3e68b.tar.gz gcc-25396db9caa179fb2e50199a9b72d579dde3e68b.tar.bz2 |
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
-rw-r--r-- | gcc/cp/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/cp/name-lookup.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/pr45330.C | 7 |
4 files changed, 17 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 8200756..8375cee 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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. diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 169a1c9..6ed164d 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 74c974c..bd12c47 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 diff --git a/gcc/testsuite/g++.dg/pr45330.C b/gcc/testsuite/g++.dg/pr45330.C index 54b245b..f16094d 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 |