Constructor called instead of opAssign()

Boris Carvajal boris2.9 at gmail.com
Tue Feb 16 09:04:43 UTC 2021


On Sunday, 14 February 2021 at 08:46:34 UTC, frame wrote:
> The first instance is in A - and why opAssign then works there?

Sorry I didn't pay too much attention.

It seems the detection of first assignment only happens when the 
field and constructor have the same parent, so it doesn't work 
either if the field is from a base or derived class (your case by 
means of casting 'this').

I don't think this is intended rather it appears to be a 
bug/deficiency in the constructor flow analysis of DMD, which 
from what I'm reading is very rudimentary.


More information about the Digitalmars-d-learn mailing list