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 23:30, Michael Matz wrote:

> Although this is not at all the same as my original issue, which was about
> calling members of an object under construction whose bases weren't yet
> initialized.

Yes, I know that was the cause of the problem,
however the diagnostic you were talking about would detect
breaches in ctor-initialisers.

> But if we are constructing interesting examples I have another one:
> 
> struct X { int x; X(int x) : x(x) {} };
> 
> This one is ok (!) and initializes X::x with the value of the constructor
> parameter 'x' ;-)

Ouch! Who invented the scoping rules in C++ again?
[Woops .. I might be doing myself in here .. ]



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