public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <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: Wed, 26 Aug 2020 08:59:06 +0000	[thread overview]
Message-ID: <bug-26950-4-LeL7mcjiNU@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-26950-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=26950

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
It's "fixed" for C++11 because N::a is meaningful for scoped enums, and fails
to find it. But the code is invalid even in C++03.

Clang and EDG both reject this even in C++03 mode. We might want to do the
same.

EDG with --c++03 says:

"e.C", line 3: error: name followed by "::" must be a class or namespace name
      enum N { e0 = N::a };
                    ^

"e.C", line 2: warning: variable "N::a" was declared but never referenced
      const int a = 42;
                ^

1 error detected in the compilation of "e.C".


Clang says:

e.C:3:19: warning: use of enumeration in a nested name specifier is a C++11
extension [-Wc++11-extensions]
    enum N { e0 = N::a };
                  ^
e.C:3:19: error: no member named 'a' in 'N::N'; did you mean simply 'a'?
    enum N { e0 = N::a };
                  ^~~~
                  a
e.C:2:15: note: 'a' declared here
    const int a = 42;
              ^
1 warning and 1 error generated.

  parent reply	other threads:[~2020-08-26  8:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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 [this message]
2022-01-08 10:48 ` pinskia at gcc dot gnu.org
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
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

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=bug-26950-4-LeL7mcjiNU@http.gcc.gnu.org/bugzilla/ \
    --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).