This is the mail archive of the
mailing list for the GCC project.
Re: unqualified name lookup in namespace bug
- To: nathan at cs dot bris dot ac dot uk
- Subject: Re: unqualified name lookup in namespace bug
- From: Martin von Loewis <martin at mira dot isdn dot cs dot tu-berlin dot de>
- Date: Tue, 4 Aug 1998 08:55:32 +0200
- CC: egcs-bugs at cygnus dot com
- References: <35C5B36C.793F@cs.bris.ac.uk>
> Is my understanding correct (and hence a bug), or am I missing
The latter :-), in particular the 'common ancestor' feature. From
>>During unqualified name lookup (3.4.1), the names appear as if they
>>were declared in the nearest enclosing namespace which contains both
>>the usingdirective and the nominated namespace.
So when looking for f in B, A::f appears as if it was declared in ::
(which is the nearest enclosing namespace that contains both A and B).
Therefore, unqualified lookup searches B, finds B::f, and terminates.
When looking up in ::g, the nearest enclosing scope is always ::, so
all names found via using-directives appear as if in ::, which gives
you both A::f and B::f.
If you want to merge the A::f variants into B::f, a using directive is
the way to go.
Hope this helps,