public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/9885: Typedef and namespace problem - scoping silently ignored
@ 2003-03-03 15:18 bangerth
0 siblings, 0 replies; 2+ messages in thread
From: bangerth @ 2003-03-03 15:18 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, nobody, steev
Synopsis: Typedef and namespace problem - scoping silently ignored
State-Changed-From-To: open->closed
State-Changed-By: bangerth
State-Changed-When: Mon Mar 3 15:18:43 2003
State-Changed-Why:
This is already fixed with the new parser:
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/gcc -c x.cc
x.cc:2: error: typedef name may not be a nested-name-specifier
Thanks for your report anyway!
Wolfgang
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9885
^ permalink raw reply [flat|nested] 2+ messages in thread
* c++/9885: Typedef and namespace problem - scoping silently ignored
@ 2003-02-28 11:06 steev
0 siblings, 0 replies; 2+ messages in thread
From: steev @ 2003-02-28 11:06 UTC (permalink / raw)
To: gcc-gnats
>Number: 9885
>Category: c++
>Synopsis: Typedef and namespace problem - scoping silently ignored
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: unassigned
>State: open
>Class: accepts-illegal
>Submitter-Id: net
>Arrival-Date: Fri Feb 28 11:06:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Steev Wilcox
>Release: g++ 3.2.1
>Organization:
>Environment:
i686-pc-linux-gnu
>Description:
I've reported this because I typed something that g++ didn't interpret in the way I (or anyone else here) expected, and I can't find any information on what really should happen. Please accept my apologies if you know about this already - I can't find it in your bug list, though.
The following code doesn't do either of the two things that I believe would be sensible:
namespace a {}
typedef int a::b;
I can't find in Stroustrup or on the web whether this is legal or not, but I reckon this code should either (i) work, ie define b in namespace a as an int, or (ii) complain that you can't do this, because you need to typedef b inside namespace a. I think option (ii), hence "accepts-illegal".
What it actually does is silently ignore the "a::" in the typedef (even with -Wall), and typedef b globally to be an int without any warnings or errors, which doesn't seem right.
Contrast this with the case when the typedef is instead a class definition. In this case, the compiler quite rightly gives an error that you can't define a::b outside of namespace a, but then defines b globally for the rest of the file before stopping. It might be that the error in the original typedef is being suppressed somehow, but the compiler carries on in the same way.
Sorry again if this isn't actually a bug. Thanks for looking into it, Steev
>How-To-Repeat:
>Fix:
Put the typedef in the namespace
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-03-03 15:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-03 15:18 c++/9885: Typedef and namespace problem - scoping silently ignored bangerth
-- strict thread matches above, loose matches on Subject: below --
2003-02-28 11:06 steev
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).