On Fri, 29 Apr 2011 13:29:56 -0400, KennyTM~ <kenn...@gmail.com> wrote:

On Apr 30, 11 01:19, Steven Schveighoffer wrote:
I think he was referring to the line:

X x = 0;

Where x could not possibly be anything other than null.

-Steve

That's definitely a bug. Why should a declaration call opAssign?

X x = new X;

is equivalent to

X x;
x = new X;

new X is an expression, which doesn't have to be the rvalue of an assignment, I suppose you can substitute any valid expression for it:

X x;
x = 0;

=>

X x = 0;

Also, if X is a struct, and the struct defines opAssign(int), this would be valid.

I wouldn't mind if it was a bug, because clearly you never want to call opAssign on an uninitialized class. But it definitely would be a special case.

-Steve

Reply via email to