public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/60994] New: gcc does not recognize hidden/shadowed enumeration as valid nested-name-specifier
@ 2014-04-29  7:00 momchil.velikov at gmail dot com
  2014-04-29  7:07 ` [Bug c++/60994] " trippels at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: momchil.velikov at gmail dot com @ 2014-04-29  7:00 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60994

            Bug ID: 60994
           Summary: gcc does not recognize hidden/shadowed enumeration as
                    valid nested-name-specifier
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: momchil.velikov at gmail dot com

gcc version 4.10.0 20140428 (experimental) (GCC)

Compiling (with c++ -c -std=c++11 b.cc) the following program

enum struct A
{
  n = 3
};

int
foo()
{
  int A;
  return A::n;
}

results in the error:

b.cc: In function 'int foo()':
b.cc:10:10: error: 'A' is not a class, namespace, or enumeration
   return A::n;
          ^
According to the C++11 Standard, [basic.lookup.qual] #1

"If a :: scope resolution operator in a nested-name-specifier is not preceded
by a decltype-specifier, lookup of the name preceding that :: considers only
namespaces, types, and templates whose specializations are types."

GCC ought not to resolve "A" to the local variable, but to the enumeration
type. This is very similar to the example in the standard 

struct A
{
  static int n;
};

int
foo()
{
  int A;
  return A::n;
}


which is compiled correctly by GCC, though.


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-12-02 11:16 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-29  7:00 [Bug c++/60994] New: gcc does not recognize hidden/shadowed enumeration as valid nested-name-specifier momchil.velikov at gmail dot com
2014-04-29  7:07 ` [Bug c++/60994] " trippels at gcc dot gnu.org
2014-04-29  7:56 ` redi at gcc dot gnu.org
2014-04-29  9:59 ` momchil.velikov at gmail dot com
2014-08-28 19:02 ` aaw at gcc dot gnu.org
2015-02-12 13:49 ` redi at gcc dot gnu.org
2015-02-12 13:53 ` jakub at gcc dot gnu.org
2015-02-12 14:28 ` momchil.velikov at gmail dot com
2015-04-14 15:30 ` jason at gcc dot gnu.org
2021-08-04 21:03 ` pinskia at gcc dot gnu.org
2021-08-04 21:04 ` pinskia at gcc dot gnu.org
2023-12-02 11:16 ` cvs-commit at gcc dot gnu.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).