diff options
author | Joseph Myers <joseph@codesourcery.com> | 2022-10-18 23:25:47 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2022-10-18 23:25:47 +0000 |
commit | f5f1d92fe2e1d75c3fae34497929a1965af704ae (patch) | |
tree | 33d46814a2a83ccababab6100c2a8c455b4f5ca3 /gcc/DATESTAMP | |
parent | cc694f45087c892e69ebbb177203c708f00b1bc7 (diff) | |
download | gcc-f5f1d92fe2e1d75c3fae34497929a1965af704ae.zip gcc-f5f1d92fe2e1d75c3fae34497929a1965af704ae.tar.gz gcc-f5f1d92fe2e1d75c3fae34497929a1965af704ae.tar.bz2 |
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.
Diffstat (limited to 'gcc/DATESTAMP')
0 files changed, 0 insertions, 0 deletions