[Bug c++/92158] Enum warning when -1 enum converted to unsigned int or int
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Oct 25 10:26:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92158
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |NEW
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Thank you for the corrected testcase, although compiling with -Werror when
asking for warnings is not very helpful (it obscures what's a warning and
what's an error) and posting code that doesn't even compile is not very helpful
either.
Confirming as a diagnostic enhancement for the following testcase:
enum E { a = -1 } ;
unsigned i = a;
Clang warns with -Wsign-conversion (not enabled by -Wall or -Wextra):
e.cc:2:14: warning: implicit conversion changes signedness: 'E' to 'unsigned
int' [-Wsign-conversion]
unsigned i = a;
~ ^
1 warning generated.
More information about the Gcc-bugs
mailing list