This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Request for a C++ warning for undefined behaviour


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 :-)



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]