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
This commit is contained in:
Jason Merrill 2006-01-26 17:29:12 -05:00 committed by Jason Merrill
parent 9391bc0df9
commit 9deb204a5a
5 changed files with 26 additions and 15 deletions

View File

@ -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:

View File

@ -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);

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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);
}