a warning to implement

Nathan Sidwell nathan@acm.org
Wed Feb 6 08:38:00 GMT 2002


Hi,
I've been reading this thread, and I still can't figure out how
	T x = x;
as anything but undefined semantics. I'm talking C++ here.
[3.3.1]/1 gives an example about point of declaration, and says of
	int x = x;
	Here ... is initialized with its own (indeterminate) value.

But, that assignment requires an lvalue to rvalue conversion on 'x',
and [4.1] says
	'or if the object is uninitialized,... undefined behaviour'

So it appears that we've got undefined behaviour for any POD T.

For a class T, we could be calling the copy ctor T(T const &).
Reference binding at [8.3.1]/4 says a reference must be bound to a
`valid object'. I suppose that it is ok to reference bind to an
object of indeterminate value.

nathan

-- 
Dr Nathan Sidwell :: Computer Science Department :: Bristol University
           The voices in my head told me to say this
nathan@acm.org  http://www.cs.bris.ac.uk/~nathan/  nathan@cs.bris.ac.uk



More information about the Gcc mailing list