From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id AEDB33858437; Wed, 5 Oct 2022 21:57:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AEDB33858437 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665007062; bh=pmkvNGCesOL05p904DOg0vC9z7YFzhHT06h2E975R/E=; h=From:To:Subject:Date:From; b=p0oGTndhXA35cqc156UsUrvqCTPasg9PDPw6DdKyGPz9VmxLNKDbB9ji/UeVFySVu 92tXx4653MzC7YnY//BRRC79EC5s0+7RG6/ExNmqRMrx68hKofuDuV3YhvvQ6rtwC6 JVBLlpZSoG2OmjJak57mlv+CFMyZy/QfNh3m2gko= From: "stephenheumann at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/107164] New: No pedantic warning for declaration just referring to a previously-declared enum type Date: Wed, 05 Oct 2022 21:57:42 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new 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: stephenheumann at gmail dot com 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: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter target_milestone Message-ID: 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 Bug ID: 107164 Summary: No pedantic warning for declaration just referring to a previously-declared enum type Product: gcc Version: 13.0 Status: UNCONFIRMED Keywords: accepts-invalid Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: stephenheumann at gmail dot com Target Milestone: --- gcc -std=3Dc17 -pedantic accepts this without any diagnostics: enum E {a,b,c}; enum E; C17 section 6.7.2.3 p9 says that an "enum identifier" type specifier using a tag with an existing declaration visible "specifies the same type as that o= ther declaration, and does not redeclare the tag". Accordingly, the second line above does not declare a declarator, a tag, or the members of an enumeratio= n, and so it violates the constraint in C17 section 6.7 p2. (The relevant standard text is basically the same from C99 through draft C2= 3. C90 is less explicit, but I think is intended to behave the same.) This should at least give a pedantic warning. Perhaps it could be an always-enabled warning, but I'm not sure if code like the above is supposed= to be allowed as a GCC extension.=