+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:
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);
// { 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);
}
// { 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;
}
// { 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);
}