Request for a C++ warning for undefined behaviour

Igor Bukanov igor@fastmail.fm
Wed Aug 13 11:19:00 GMT 2003


It would also be nice if GCC would warn about the following code:

int x = x + 1;

Few years ago I spend some hours fixing that but even with GCC 3.2.2 
"gcc -Wall" gives no warnings for that.

At least in C "int x = x + 1;" is error if used outside functions but in 
C++ the following compiles warningless in any scope:

const int x = x + 1;

Regards, Igor





More information about the Gcc mailing list