From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 32E3D3851C3C; Wed, 26 Aug 2020 08:59:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 32E3D3851C3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1598432346; bh=9OGrzLf0fpLMCsSxckHRsuTWj84xAFh6SJ7YgmD1uwU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=UPwDcf4HVVU+LADyfmhJzl8/v4kycToB/niY+pYHf9IF3cPSRo7s8suxyHQvwYFe2 UEOtFB4ZzQhVK+d7IFswdveKsPVWNVdkU14XTOC2kj6LsmNCqIK3Q+Ih9OGN7XSBYv ohIxBvxezp1xRy/8DZL+gCQCr+NOaIXr8v0vp30I= From: "redi at gcc dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 4.0.1 X-Bugzilla-Keywords: accepts-invalid X-Bugzilla-Severity: minor X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.4.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2020 08:59:06 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D26950 --- Comment #7 from Jonathan Wakely --- It's "fixed" for C++11 because N::a is meaningful for scoped enums, and fai= ls 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 na= me enum N { e0 =3D N::a }; ^ "e.C", line 2: warning: variable "N::a" was declared but never referenced const int a =3D 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 =3D N::a }; ^ e.C:3:19: error: no member named 'a' in 'N::N'; did you mean simply 'a'? enum N { e0 =3D N::a }; ^~~~ a e.C:2:15: note: 'a' declared here const int a =3D 42; ^ 1 warning and 1 error generated.=