copy-ctor's

Manu turkeyman at gmail.com
Sun May 26 20:38:48 UTC 2019


On Sat, May 25, 2019 at 9:15 PM Nicholas Wilson via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
>
> 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.

Right, but it's not a helpful behaviour; it undermines copy ctors...
in my example above, 'S' can't control the template argument, which
means `T` may have a postblit and so `S` can't possibly be written to
work.

> > 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.

Indeed.

I also noticed another one; it doesn't just call postblit's for each
item in the union, it also calls destructors for each item in the
union! O_O
How has this issue never come up?

> > 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.

I don't know his email address... that CC box seems to work by email addresses.


More information about the Digitalmars-d mailing list