From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1915 invoked by alias); 29 Apr 2014 07:00:31 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 1858 invoked by uid 48); 29 Apr 2014 07:00:26 -0000 From: "momchil.velikov at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/60994] New: gcc does not recognize hidden/shadowed enumeration as valid nested-name-specifier Date: Tue, 29 Apr 2014 07:00:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 4.10.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: momchil.velikov at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-04/txt/msg02111.txt.bz2 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.