copy-ctor's

Nicholas Wilson iamthewilsonator at hotmail.com
Sun May 26 04:11:10 UTC 2019


On Saturday, 25 May 2019 at 23:15:05 UTC, Manu wrote:
> So, it seems that if an object has a postblit and a copy 
> constructor, the postblit is preferred.

Correct, that is the transitional behaviour until postblit is 
truly dead.

> It also seems that if an object has a copy constructor and a 
> MEMBER with a postblit, then object has a postblit generated 
> which calls through to the member, and that is preferred.

Thats probably a bit of a grey area. I'll defer to Razvan for 
that one.

> I have also noticed that if you have a union containing an item 
> with a postblit, the postblit is always called, even if the 
> item in the union is not valid:

Thats a bug.

> So, it's very hard to craft a tool like 'S', when the supplied 
> T might have a postblit and ruin everything. What are my 
> options here?

File a bug report and ensure that Razvan Nitu is CC'd.

> Also, `hasElaborateCopyConstructor` is broken now. It should 
> know about copy ctor's.

https://run.dlang.io/gist/71e722a80b5a9ab54625508915bc7738?compiler=dmd-beta _almost_ does it, I'm not quite sure what I'm missing though.


More information about the Digitalmars-d mailing list