Commit dc55c941 by Alexandre Oliva Committed by Alexandre Oliva

re PR c++/13594 (namespace association vs. templates part two)

PR c++/13594
PR c++/13658
* name-lookup.c (qualified_lookup_using_namespace): Search
strongly-associated namespaces first, and only then try other
namespaces.

From-SVN: r75921
parent b5eb5a5e
2004-01-15 Alexandre Oliva <aoliva@redhat.com>
PR c++/13594
PR c++/13658
* name-lookup.c (qualified_lookup_using_namespace): Search
strongly-associated namespaces first, and only then try other
namespaces.
2004-01-15 Kelley Cook <kcook@gcc.gnu.org> 2004-01-15 Kelley Cook <kcook@gcc.gnu.org>
* Make-lang.in (c++.srcextra): Dummy entry. * Make-lang.in (c++.srcextra): Dummy entry.
......
...@@ -3778,6 +3778,7 @@ qualified_lookup_using_namespace (tree name, tree scope, cxx_binding *result, ...@@ -3778,6 +3778,7 @@ qualified_lookup_using_namespace (tree name, tree scope, cxx_binding *result,
tree seen = NULL_TREE; tree seen = NULL_TREE;
/* ... and a list of namespace yet to see. */ /* ... and a list of namespace yet to see. */
tree todo = NULL_TREE; tree todo = NULL_TREE;
tree todo_maybe = NULL_TREE;
tree usings; tree usings;
timevar_push (TV_NAME_LOOKUP); timevar_push (TV_NAME_LOOKUP);
/* Look through namespace aliases. */ /* Look through namespace aliases. */
...@@ -3797,16 +3798,36 @@ qualified_lookup_using_namespace (tree name, tree scope, cxx_binding *result, ...@@ -3797,16 +3798,36 @@ qualified_lookup_using_namespace (tree name, tree scope, cxx_binding *result,
for (usings = DECL_NAMESPACE_USING (scope); usings; for (usings = DECL_NAMESPACE_USING (scope); usings;
usings = TREE_CHAIN (usings)) usings = TREE_CHAIN (usings))
/* If this was a real directive, and we have not seen it. */ /* If this was a real directive, and we have not seen it. */
if (!TREE_INDIRECT_USING (usings) if (!TREE_INDIRECT_USING (usings))
&& ((!result->value && !result->type) {
|| is_associated_namespace (scope, TREE_PURPOSE (usings))) /* Try to avoid queuing the same namespace more than once,
&& !purpose_member (TREE_PURPOSE (usings), seen)) the exception being when a namespace was already
enqueued for todo_maybe and then a strong using is
found for it. We could try to remove it from
todo_maybe, but it's probably not worth the effort. */
if (is_associated_namespace (scope, TREE_PURPOSE (usings))
&& !purpose_member (TREE_PURPOSE (usings), seen)
&& !purpose_member (TREE_PURPOSE (usings), todo))
todo = tree_cons (TREE_PURPOSE (usings), NULL_TREE, todo); todo = tree_cons (TREE_PURPOSE (usings), NULL_TREE, todo);
else if ((!result->value && !result->type)
&& !purpose_member (TREE_PURPOSE (usings), seen)
&& !purpose_member (TREE_PURPOSE (usings), todo)
&& !purpose_member (TREE_PURPOSE (usings), todo_maybe))
todo_maybe = tree_cons (TREE_PURPOSE (usings), NULL_TREE,
todo_maybe);
}
if (todo) if (todo)
{ {
scope = TREE_PURPOSE (todo); scope = TREE_PURPOSE (todo);
todo = TREE_CHAIN (todo); todo = TREE_CHAIN (todo);
} }
else if (todo_maybe
&& (!result->value && !result->type))
{
scope = TREE_PURPOSE (todo_maybe);
todo = TREE_CHAIN (todo_maybe);
todo_maybe = NULL_TREE;
}
else else
scope = NULL_TREE; /* If there never was a todo list. */ scope = NULL_TREE; /* If there never was a todo list. */
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment