From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7F43D385843E; Tue, 18 Oct 2022 23:26:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7F43D385843E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666135598; bh=10C4+wqUyv3vXFvub5wh8qCv+7Y5wRExFMpO1LKJFIo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=u+TsV+KxYaB/8Z1giYZ+F2KxiZ1PZbV2e4q89y0wancidCr+I3cbq2adJf+bP9wx/ 5koMluMF06TYHZlz4ku10oWL9Q9fM8E8yDLiAit+p1cWh0d1VfQnC1ZhXwQSGTEGc0 c5aIEDoklzzLXeJGPwODn2wDmwjV4g0G0E5jfTmc= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/107164] No pedantic warning for declaration just referring to a previously-declared enum type Date: Tue, 18 Oct 2022 23:26:37 +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: 13.0 X-Bugzilla-Keywords: accepts-invalid X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107164 --- Comment #2 from CVS Commits --- The master branch has been updated by Joseph Myers : https://gcc.gnu.org/g:f5f1d92fe2e1d75c3fae34497929a1965af704ae commit r13-3366-gf5f1d92fe2e1d75c3fae34497929a1965af704ae Author: Joseph Myers Date: Tue Oct 18 23:25:47 2022 +0000 c: Diagnose "enum tag;" after definition [PR107164] As noted in bug 101764, a declaration "enum tag;" is invalid in standard C after a definition, as well as when no definition is visible; we had a pedwarn-if-pedantic for the forward declaration case, but were missing one for the other case. Add that missing diagnostic (if pedantic only). (These diagnostics will need to be appropriately conditioned when support is added for C2x enums with fixed underlying type, since "enum tag : type;" is OK both before and after a definition.) Bootstrapped with no regressions for x86_64-pc-linux-gnu. PR c/107164 gcc/c/ * c-decl.cc (shadow_tag_warned): If pedantic, diagnose "enum ta= g;" with previous declaration visible. gcc/testsuite/ * gcc.dg/c99-tag-4.c, gcc.dg/c99-tag-5.c, gcc.dg/c99-tag-6.c: N= ew tests.=