public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/22066] New: :: can access default/anon namespace instead of just global namespace
@ 2005-06-14 19:22 t8 at pobox dot com
2005-06-14 19:37 ` [Bug c++/22066] " pinskia at gcc dot gnu dot org
0 siblings, 1 reply; 2+ messages in thread
From: t8 at pobox dot com @ 2005-06-14 19:22 UTC (permalink / raw)
To: gcc-bugs
Not positive this is a bug, but I think so.
This code compiles and prints 0:
#include <iostream>
namespace {
int i = 0;
}
int main(int argc, char** argv)
{
std::cout << "i=" << ::i << std::endl;
return 0;
}
I'd expect it to complain that i isn't in the global namespace
(since it is in the anon/default one).
Removing the :: prefix from i also works, as it should.
Apparently, the MS VC++ .NET (a later version, not sure which)
does complain (though that doesn't necessarily mean much in itself).
Thanks.
PS: This is using the Redhat built/distrubuted:
g++ (GCC) 3.4.3 20050227 (Red Hat 3.4.3-22.fc3)
on Fedora core 3.
--
Summary: :: can access default/anon namespace instead of just
global namespace
Product: gcc
Version: 3.4.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: t8 at pobox dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: i386 GNU/Linux
GCC target triplet: i386 GNU/Linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22066
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/22066] :: can access default/anon namespace instead of just global namespace
2005-06-14 19:22 [Bug c++/22066] New: :: can access default/anon namespace instead of just global namespace t8 at pobox dot com
@ 2005-06-14 19:37 ` pinskia at gcc dot gnu dot org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-14 19:37 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-06-14 19:37 -------
Unnamed namespaces are injected into the same scope as the previous namespace.
See example in 7.3.1.1 where it refers to A::i where i is in an unnamed namespace of the named one
(A).
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22066
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-06-14 19:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-14 19:22 [Bug c++/22066] New: :: can access default/anon namespace instead of just global namespace t8 at pobox dot com
2005-06-14 19:37 ` [Bug c++/22066] " pinskia at gcc dot gnu dot org
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).