https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92675
Bug ID: 92675 Summary: sign-conversion C++ unsigned int j = -1; Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jg at jguk dot org Target Milestone: --- Could G++ also give a nice error for -Wsign-conversion ? unsigned int j = -1; GCC does already for C code, as does Clang C++ #1 with x86-64 gcc (trunk) <source>:1:18: warning: unsigned conversion from 'int' to 'unsigned int' changes value from '-1' to '4294967295' [-Wsign-conversion] 1 | unsigned int j = -1; | ^~ Clang gives a nice error with C++: #1 with x86-64 clang (trunk) <source>:1:18: warning: implicit conversion changes signedness: 'int' to 'unsigned int' [-Wsign-conversion] unsigned int j = -1; ~ ^~ 1 warning generated. Compiler returned: 0 Compiler returned: 1