https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101764
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Joseph Myers <js...@gcc.gnu.org>: https://gcc.gnu.org/g:f5f1d92fe2e1d75c3fae34497929a1965af704ae commit r13-3366-gf5f1d92fe2e1d75c3fae34497929a1965af704ae Author: Joseph Myers <jos...@codesourcery.com> 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 tag;" with previous declaration visible. gcc/testsuite/ * gcc.dg/c99-tag-4.c, gcc.dg/c99-tag-5.c, gcc.dg/c99-tag-6.c: New tests.