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
- Subject: Re: Namespace 'using' at global scope, recently broken
- From: Martin von Loewis <martin at mira dot isdn dot cs dot tu-berlin dot de>
- Date: Thu, 27 Aug 1998 09:28:15 +0200
- CC: egcs-bugs at cygnus dot com
- References: <199808261452.JAA12788@homebase.citilink.com>
> 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 `::Some::Display'
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.
Alas, if you use the using directive, this is not an error,
yet. However, later unqalified lookup will find two types (::Display
and Some::Display), which is ambiguous, and therefore an error.
Earlier g++ snapshots did not detect these errors.
OTOH, if you have a function-scope using declaration, you introduce
Some::Display into the scope of the function. It then hides ::Display,
that's why it works.