This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/81830] New: missing Wunused-local-typedef on a typedef of an unnamed enum or struct
- From: "msebor at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 11 Aug 2017 20:09:22 +0000
- Subject: [Bug c++/81830] New: missing Wunused-local-typedef on a typedef of an unnamed enum or struct
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81830
Bug ID: 81830
Summary: missing Wunused-local-typedef on a typedef of an
unnamed enum or struct
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: msebor at gcc dot gnu.org
Target Milestone: ---
GCC (in C mode) correctly diagnoses the unused typedefs in each of the two
functions below. G++, however, only diagnoses those in f and misses those in
g. Clang diagnoses all of them in both modes.
$ cat x.c && gcc -O2 -S -Wall -Wextra -Wpedantic -Wunused -xc++ x.c
void f (void)
{
typedef enum E { e } F; // -Wunused-local-typedefs
typedef struct A { int i; } B; // ditto
}
void g (void)
{
typedef enum { e } F; // missing -Wunused-local-typedefs in C++
typedef struct { int i; } B; // ditto
}
x.c: In function ‘void f()’:
x.c:3:24: warning: typedef ‘F’ locally defined but not used
[-Wunused-local-typedefs]
typedef enum E { e } F; // -Wunused-local-typedefs
^
x.c:4:31: warning: typedef ‘B’ locally defined but not used
[-Wunused-local-typedefs]
typedef struct A { int i; } B; // ditto
^