public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/42490]  New: using-directive in namespace doesn't work properly
@ 2009-12-24 15:01 gcc-bugzilla at contacts dot eelis dot net
  2010-01-07 21:05 ` [Bug c++/42490] " redi at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: gcc-bugzilla at contacts dot eelis dot net @ 2009-12-24 15:01 UTC (permalink / raw)
  To: gcc-bugs

Consider:

  namespace B { struct C {}; }
  namespace A { namespace C { } using namespace B; }
  struct A::C c;

GCC complains:

  error: 'C' in namespace 'A' does not name a type

Not knowing much about the subtleties of name lookup myself, I'm relying on the
following two sources for the code's well-formed-ness:

* Comeau 4.3.10.1 /does/ accept the code.
* The opinion of a particularly well-read regular (litb) on Freenode's C++ IRC
channel.


-- 
           Summary: using-directive in namespace doesn't work properly
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gcc-bugzilla at contacts dot eelis dot net


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42490


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/42490] using-directive in namespace doesn't work properly
  2009-12-24 15:01 [Bug c++/42490] New: using-directive in namespace doesn't work properly gcc-bugzilla at contacts dot eelis dot net
@ 2010-01-07 21:05 ` redi at gcc dot gnu dot org
  2010-02-11 23:28 ` schaub-johannes at web dot de
  2010-02-11 23:39 ` schaub-johannes at web dot de
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu dot org @ 2010-01-07 21:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from redi at gcc dot gnu dot org  2010-01-07 21:05 -------
I think the code is valid

3.4.4 [basic.lookup.elab]/1
An elaborated-type-specifier (7.1.6.3) may be used to refer to a
previously declared class-name or enum-name even though the name has
been hidden by a non-type declaration (3.3.10).


-- 

redi at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-01-07 21:05:41
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42490


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/42490] using-directive in namespace doesn't work properly
  2009-12-24 15:01 [Bug c++/42490] New: using-directive in namespace doesn't work properly gcc-bugzilla at contacts dot eelis dot net
  2010-01-07 21:05 ` [Bug c++/42490] " redi at gcc dot gnu dot org
@ 2010-02-11 23:28 ` schaub-johannes at web dot de
  2010-02-11 23:39 ` schaub-johannes at web dot de
  2 siblings, 0 replies; 4+ messages in thread
From: schaub-johannes at web dot de @ 2010-02-11 23:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from schaub-johannes at web dot de  2010-02-11 23:28 -------
I also think the code is valid. In this case though, there is the complication
that no hiding takes place: The qualified name lookup of "X::m" for namespace
members says in 3.4.3.2/2: "using-directives are ignored in any namespace,
including X, directly containing one or more declarations of m". That would
mean that "using namespace B;" is ignored, because "C" is declared as a
namespace there. 

But 3.4.4/3 says: "If the name is a qualified-id, the name is looked up
according its qualifications, as described in 3.4.3, but ignoring any non-type
names that have been declared.". That is, the declaration of the namespace is
ignored, thus not preventing the consideration of the using directive. 


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42490


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/42490] using-directive in namespace doesn't work properly
  2009-12-24 15:01 [Bug c++/42490] New: using-directive in namespace doesn't work properly gcc-bugzilla at contacts dot eelis dot net
  2010-01-07 21:05 ` [Bug c++/42490] " redi at gcc dot gnu dot org
  2010-02-11 23:28 ` schaub-johannes at web dot de
@ 2010-02-11 23:39 ` schaub-johannes at web dot de
  2 siblings, 0 replies; 4+ messages in thread
From: schaub-johannes at web dot de @ 2010-02-11 23:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from schaub-johannes at web dot de  2010-02-11 23:39 -------
(In reply to comment #2)
> I also think the code is valid. In this case though, there is the complication
> that no hiding takes place [...]
> 

Wasn't aware that this is also a case of hiding, but 3.3.10 about hiding
actually even contains it. 


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42490


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-02-11 23:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-24 15:01 [Bug c++/42490] New: using-directive in namespace doesn't work properly gcc-bugzilla at contacts dot eelis dot net
2010-01-07 21:05 ` [Bug c++/42490] " redi at gcc dot gnu dot org
2010-02-11 23:28 ` schaub-johannes at web dot de
2010-02-11 23:39 ` schaub-johannes at web dot de

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).