From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 151FF3858439; Thu, 4 Nov 2021 19:07:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 151FF3858439 From: "aaron at aaronballman dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/103084] Accepts invalid using enum declaration with an invalid elaborated-type-specifier Date: Thu, 04 Nov 2021 19:07:58 +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: 12.0 X-Bugzilla-Keywords: accepts-invalid X-Bugzilla-Severity: normal X-Bugzilla-Who: aaron at aaronballman dot com 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: --- 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: Thu, 04 Nov 2021 19:07:58 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103084 --- Comment #8 from Aaron Ballman --- (In reply to M Welinder from comment #6) > elaborated-enum-specifier can be a elaborated-type-specifier. It is in t= he > "enum Hog H;" case. >=20 > But elaborated-enum-specifier is NOT an elaborated-type-specifier in the > "using enum Hog;" case, >=20 > See http://eel.is/c++draft/enum.udecl -- this uses elaborated-enum-specif= ier > directly. You're correct about the productions, but http://eel.is/c++draft/dcl.type.e= lab then provides no semantics whatsoever for what type is referred to by an elaborated-enum-specifier. https://eel.is/c++draft/dcl.type.elab#6 would not apply, so the only requirement on the type then comes from http://eel.is/c++draft/enum.udecl#1, which says that the type referred to m= ust be a reachable enum-specifier. But the type named isn't a reachable enum-specifier (maybe, who knows, no semantics means we can't really say), = it's a type alias to an enum-specifier. So there's confusion either way you read= it, IMO. (In reply to M Welinder from comment #7) > Maybe kick it up to the C++ people? > > Note, that if the code is not allowed then a type alias is no longer as > powerful as the original type. I really doubt that was intended. FWIW, my initial inclination was that Clang and ICC were wrong to reject because this does seem like a useful construct that should be supported. It= is possible there's a Core issue here and that this should not be rejected. The original paper on the topic doesn't say anything, and I didn't see a mentio= n of type aliases in the WG21 wiki discussions for the paper, but it's entirely possible I missed something while looking. So I agree that it'd be useful to allow this, but I'm not convinced the standard permits it currently.=