Request for a C++ warning for undefined behaviour

skaller skaller@ozemail.com.au
Wed Aug 13 12:40:00 GMT 2003


On Wed, 2003-08-13 at 19:46, Igor Bukanov wrote:
> It would also be nice if GCC would warn about the following code:
> 
> int x = x + 1;
> 
Actually there is an interesting variant that exhibits both
this issue and the one raise by Michael Matx:

struct X { int x; X() : x(x) {} };

which not only initialises a variable to itself,
but also manages to refer to a variable before its
ctor-initialiser has initialised it :-)




More information about the Gcc mailing list