https://gcc.gnu.org/bugzilla/show_bug.cgi?id=16804
Eric Gallager <egallager at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |egallager at gcc dot gnu.org
Summary|Function pointer |Function pointer
|assignment/initialization |assignment/initialization
|(missing warning) |(-Wc++-compat warning
| |missing from
| |-Wincompatible-pointer-type
| |s)
--- Comment #7 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Martin Sebor from comment #6)
> GCC does diagnose the initialization with -Wc++-compat so it seems that
> making this work as suggested is just a matter of including the same warning
> in -Wincompatible-pointer-types:
>
> $ gcc -S -Wc++-compat -xc z.C
> z.C:3:27: warning: pointer target types incompatible in C++ [-Wc++-compat]
> 3 | enum Moo (*Miau) (void) = quack;
> | ^~~~~
>
> Even if enums are strictly compatible with unsigned the mismatch still is
> suggestive of a mistake on the part of the programmer and the warning would
> help detect it.
Retitling to clarify