diff options
author | Jason Merrill <jason@redhat.com> | 2006-01-26 17:29:12 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2006-01-26 17:29:12 -0500 |
commit | 9deb204a5a7f43018120c083a28430910364b8ca (patch) | |
tree | 493b0d86d9da80f50584013cbc785bd5680f3f01 | |
parent | 9391bc0df99d799bb04e701e62f9a1e0786c9c14 (diff) | |
download | gcc-9deb204a5a7f43018120c083a28430910364b8ca.zip gcc-9deb204a5a7f43018120c083a28430910364b8ca.tar.gz gcc-9deb204a5a7f43018120c083a28430910364b8ca.tar.bz2 |
re PR c++/16021 (Tests for container swap specialisations FAIL in debug mode)
PR c++/16021
* name-lookup.c (parse_using_directive): Require strong using to
name a nested namespace.
From-SVN: r110282
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/name-lookup.c | 11 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/lookup/strong-using-1.C | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/lookup/strong-using-2.C | 12 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/lookup/strong-using-3.C | 6 |
5 files changed, 26 insertions, 15 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9dea52e..741d3de 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2006-01-26 Jason Merrill <jason@redhat.com> + + PR c++/16021 + * name-lookup.c (parse_using_directive): Require strong using to + name a nested namespace. + 2006-01-25 Volker Reichelt <reichelt@igpm.rwth-aachen.de> Revert: diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index e0ee7a2..2f33b09 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -3295,9 +3295,14 @@ parse_using_directive (tree namespace, tree attribs) if (!toplevel_bindings_p ()) error ("strong using only meaningful at namespace scope"); else if (namespace != error_mark_node) - DECL_NAMESPACE_ASSOCIATIONS (namespace) - = tree_cons (current_namespace, 0, - DECL_NAMESPACE_ASSOCIATIONS (namespace)); + { + if (!is_ancestor (current_namespace, namespace)) + error ("current namespace %qD does not enclose strongly used namespace %qD", + current_namespace, namespace); + DECL_NAMESPACE_ASSOCIATIONS (namespace) + = tree_cons (current_namespace, 0, + DECL_NAMESPACE_ASSOCIATIONS (namespace)); + } } else warning (OPT_Wattributes, "%qD attribute directive ignored", name); diff --git a/gcc/testsuite/g++.dg/lookup/strong-using-1.C b/gcc/testsuite/g++.dg/lookup/strong-using-1.C index 3d63f25..a16fd6a 100644 --- a/gcc/testsuite/g++.dg/lookup/strong-using-1.C +++ b/gcc/testsuite/g++.dg/lookup/strong-using-1.C @@ -2,10 +2,10 @@ // { dg-do compile } -namespace foo { - template <class T> void swap(T, T); -} namespace fool { + namespace foo { + template <class T> void swap(T, T); + } using namespace foo __attribute__((strong)); template <class T> void swap(T); } diff --git a/gcc/testsuite/g++.dg/lookup/strong-using-2.C b/gcc/testsuite/g++.dg/lookup/strong-using-2.C index f8b5f64..21e47cb 100644 --- a/gcc/testsuite/g++.dg/lookup/strong-using-2.C +++ b/gcc/testsuite/g++.dg/lookup/strong-using-2.C @@ -2,16 +2,16 @@ // { dg-do compile } -namespace foo_impl { - class T; // { dg-error "T" "" } -} -namespace bar_impl { - class T; // { dg-error "T" "" } -} namespace foo { + namespace foo_impl { + class T; // { dg-error "T" "" } + } using namespace foo_impl __attribute__((strong)); } namespace bar { + namespace bar_impl { + class T; // { dg-error "T" "" } + } using namespace bar_impl __attribute__((strong)); using namespace foo; } diff --git a/gcc/testsuite/g++.dg/lookup/strong-using-3.C b/gcc/testsuite/g++.dg/lookup/strong-using-3.C index 2ea538e..9b4d3c3 100644 --- a/gcc/testsuite/g++.dg/lookup/strong-using-3.C +++ b/gcc/testsuite/g++.dg/lookup/strong-using-3.C @@ -2,10 +2,10 @@ // { dg-do compile } -namespace foo { - template <class T> void f(T, T); -} namespace bar { + namespace foo { + template <class T> void f(T, T); + } using namespace foo __attribute__((strong)); template <class T> void f(T); } |