copying a struct containing a struct

Rob T rob at ucora.com
Fri Nov 16 14:45:58 PST 2012


On Friday, 16 November 2012 at 22:24:09 UTC, monarch_dodra wrote:
> --------
> The fact that "opAssign called for: " is not printed is, AFAIK, 
> a HUGE and old standing bug: The fields of the struct are bit 
> copied (!)
>
> Frankly, I have no idea why it isn't fixed yet...
>
> To "bypass" this "bug", simply define an opAssign yourself.

This should be a compiler error or at the very least issue a 
warning.

It seems to me that overridden sub-struct opAssign needs to be 
chained together, and it's a compiler error if there's a break in 
the chain, i.e., if a sub-level struct has non-default opAssign, 
then the parent must have one too, else it's an error.


--rt


More information about the Digitalmars-d mailing list