This is the mail archive of the
mailing list for the GCC project.
Re: Namespace 'using' at global scope, recently broken
- To: jstern at citilink dot com, martin at mira dot isdn dot cs dot tu-berlin dot de
- Subject: Re: Namespace 'using' at global scope, recently broken
- From: Josh Stern <jstern at citilink dot com>
- Date: Thu, 27 Aug 1998 08:50:01 -0500 (CDT)
- Cc: egcs-bugs at cygnus dot com
- Posted-Date: Thu, 27 Aug 1998 08:50:01 -0500 (CDT)
>> Simple attempts at namespace 'using' directives with global
>> scope mis-fire with the 08-24 snapshot. This did work fairly
>You did not mention what the error message is. I get
>dumm.cc:6: conflicting types for `class ::Some::Display'
>/usr/include/X11/Xlib.h:480: previous declaration as
>`typedef struct _XDisplay Display'
>dumm.cc:6: using directive `Display' introduced ambiguous type
>This seems like an error to me: X11R6 defines a global type called
>Display, and your using declaration also introduces a global type
>(i.e. a member of the default namespace) with the name Display. This
>is an error.
You may be right, but I am not convinced. From the CD2 version
of the standard, in 22.214.171.124:
" During unqualified name look up (_basic.lookup.unqual_),
the names appear as if they were declared in
the nearest enclosing namespace which contains both the
using-direc-tive and the nominated namespace. [Note: in this
context, "contains" means "contains directly or indirectly". ]
A using-directive does not add any members to the declarative
region in which it appears."
I interpret that last sentence to be at odds with your explanation,
and expect the "appear as if" behavior to be what I intentended in
my example code (overriding the unqualified name 'Display').
On the other hand, it is possible that what this text meant to
convey (somewhat uncessarily in this context) is that the using
directive doesn't have any effect in other places where it is
not applied (in my example, I don't expect it to have any effect
in other translation units).
I checked back and found that at least the August 03 egcs snapshot
agreed with the behavior I expected, so if someone changed this
intentionally they can probably speak up with their (probably