https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81830

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
For unnamed class and enumeration types the typedef is the name of the type for
linkage purposes, so it can be used even if it's never referred to e.g.

template<typename T> void use(T) { }

void g (void)
{
  typedef enum { e } F;          // missing -Wunused-local-typedefs in C++
  use(e);
}

The name 'F' is needed for the mangled name of use<F> even though it's not used
directly in the source. So that's probably why G++ treats the typedef names as
used. Maybe it could be made smarter, so that if no name is needed for linkage
purposes, then it still warns.

Reply via email to