public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "t8 at pobox dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/22066] New: :: can access default/anon namespace instead of just global namespace
Date: Tue, 14 Jun 2005 19:22:00 -0000	[thread overview]
Message-ID: <20050614192245.22066.t8@pobox.com> (raw)

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


             reply	other threads:[~2005-06-14 19:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-14 19:22 t8 at pobox dot com [this message]
2005-06-14 19:37 ` [Bug c++/22066] " pinskia at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050614192245.22066.t8@pobox.com \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).