public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "widman at gimpel dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/26950] Error diagnostic not issued for unacceptable result of lookup for a name used in a nested-name-specifier Date: Thu, 30 Mar 2006 21:06:00 -0000 [thread overview] Message-ID: <20060330210604.24494.qmail@sourceware.org> (raw) In-Reply-To: <bug-26950-10061@http.gcc.gnu.org/bugzilla/> ------- Comment #2 from widman at gimpel dot com 2006-03-30 21:06 ------- Subject: Error diagnostic not issued for unacceptable result of lookup for a name used in a nested-name-specifier On Mar 30, 2006, at 2:56 PM, Daveed Vandevoorde wrote: > Hi James, > > On Mar 30, 2006, at 2:31 PM, James Widman wrote: > >> [This can probably also be categorized as "low priority".] >> >> The GCC and EDG front ends both appear to think that this test >> case is well-formed: >> >> namespace N { >> const int a = 42; >> enum N { e0 = N::a }; >> } >> >> ... but I think 3.4.3p1 makes it ill-formed. > > > Can you elaborate on that? 3.4.3/1 says: > > The name of a class or namespace member can be referred to > after the :: scope resolution operator (5.1) applied to a > nested-name-specifier that nominates its class or namespace. > During the lookup for a name preceding the :: scope resolution > operator, object, function, and enumerator names are ignored. > If the name found is not a class-name (clause 9) or > namespace-name (7.3.1), the program is ill-formed. > > So when looking up N in N::a, the "enum N" entry is ignored, and the > "namespace N" entry is found. "a" is a member of that namespace, and > it can be used in an integral constant-expression. > > Am I missing something? > > Daveed Vandevoorde > Edison Design Group "enum N" is not an enumerator name; it's an enumeration name (or an / enum-name/ [7.2p1]), so "enum N" cannot be ignored. In C (ignoring the namespace N for now), we would say that the enumeration name N resides in the tag name space (along with the tag names of structs and unions) and e0 resides in the ordinary name space (along with the names of functions, variables, and typedef names -- see C89: 3.1.2.3, C99:6.2.3). So when I read that excerpt of 3.4.3/1, I thought to myself: "During the lookup for a name preceding the :: scope resolution operator, ordinary names are ignored, except that typedef names and namespace names are considered." ... with the implication being that tag names (including the names of classes, unions, and enumerations) are considered without exception. >> I also reported this to: >> >> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26950 >> >> MSVC (6 through 8) and Borland 5.6 appear to treat the enum-name >> as hiding the namespace name during lookup for the nested-name- >> specifier. >> >> James Widman >> -- >> Gimpel Software >> http://gimpel.com >> >> > James Widman -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26950
next prev parent reply other threads:[~2006-03-30 21:06 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2006-03-30 19:20 [Bug c++/26950] New: " widman at gimpel dot com 2006-03-30 20:02 ` [Bug c++/26950] " pinskia at gcc dot gnu dot org 2006-03-30 21:06 ` widman at gimpel dot com [this message] 2006-03-30 23:31 ` widman at gimpel dot com 2006-03-31 5:36 ` widman at gimpel dot com 2008-02-10 14:09 ` manu at gcc dot gnu dot org [not found] <bug-26950-4@http.gcc.gnu.org/bugzilla/> 2020-08-26 8:55 ` redi at gcc dot gnu.org 2020-08-26 8:59 ` redi at gcc dot gnu.org 2022-01-08 10:48 ` pinskia at gcc dot gnu.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=20060330210604.24494.qmail@sourceware.org \ --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: linkBe 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).