This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH] Fix friend class name lookup part 2/n (PR14513, 15410)
Kriang Lerdsuwanakij wrote:
Hi
Thank you for the review. I discovered a flaw in my earlier patch.
It fails to take into account namespace from decl_namespace_list, etc.
when walking through binding_level's. So the following case are not
handled correctly:
namespace N { class C; }
class N::C {
friend class D;
};
When walking through binding_levels, we jump from the scope of class 'C'
directly to global namespace. But the name 'D' should be placed in
in namespace 'N'.
So my patch has to be tweaked in 4 chunks which are summarized below.
OK with the changes? It is tested on i686-pc-linux-gnu. The patch will
have to wait for another change of mine in libjava since it assume that,
for code example above, the tag will be pushed into global namespace.
--Kriang
Change summary:
The first part is the addition in the function lookup_type_scope. Just
grab the namespace from current_decl_namespace when we hit a namespace
scope:
whilst using current_decl_namespace seems plausable, why don't we push to
the namespace of N::C when processing its definition? Am I just confused?
I think there's a lot of places where current_namespace is presumed to be
the namespace of whatever function or class is being defined.
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk