From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B3BF1385842B; Fri, 29 Apr 2022 19:08:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B3BF1385842B From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/67048] [9/10/11/12/13 Regression] GCC rejects well-formed program using empty anonymous enum specifier in a variable declaration Date: Fri, 29 Apr 2022 19:08:39 +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: 9.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, 29 Apr 2022 19:08:39 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D67048 --- Comment #4 from CVS Commits --- The trunk branch has been updated by Marek Polacek : https://gcc.gnu.org/g:fd0d3e9121c5aa65150d242676be6bbdc8d4a92a commit r13-51-gfd0d3e9121c5aa65150d242676be6bbdc8d4a92a 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.=