From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8590F3858412; Fri, 12 Aug 2022 08:11:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8590F3858412 From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/67048] [10/11/12 Regression] GCC rejects well-formed program using empty anonymous enum specifier in a variable declaration Date: Fri, 12 Aug 2022 08:11:11 +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: 11.1.0 X-Bugzilla-Keywords: diagnostic, rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: mpolacek at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.5 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: Fri, 12 Aug 2022 08:11:11 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D67048 --- Comment #8 from CVS Commits --- The releases/gcc-12 branch has been updated by Richard Biener : https://gcc.gnu.org/g:60fed79c1e9a968eaedf292b298d19c9475ad37a commit r12-8683-g60fed79c1e9a968eaedf292b298d19c9475ad37a Author: Marek Polacek Date: Thu Apr 28 16:50:06 2022 -0400 c++: pedwarn for empty unnamed enum in decl [PR67048] [dcl.dcl]/5 says that enum { }; is ill-formed, and since r197742 we issue a pedwarn. However, the pedwarn also fires for enum { } x; which is well-formed. So only warn when {} is followed by a ;. This should be correct since you can't have "enum {}, " -- that produces "expected unqualified-id before ',' token". PR c++/67048 gcc/cp/ChangeLog: * parser.cc (cp_parser_enum_specifier): Warn about empty unnamed enum only when it's followed by a semicolon. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/enum42.C: New test. (cherry picked from commit fd0d3e9121c5aa65150d242676be6bbdc8d4a92a)=