[Issue 21349] copy and postblit constructors aren't compatible

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Oct 29 17:25:29 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=21349

--- Comment #6 from Илья Ярошенко <ilyayaroshenko at gmail.com> ---
I have thought think about these lines

> For backward compatibility reasons, a struct that defines both a copy
> constructor and a postblit will only use the postblit for implicit copying.

What they are really about?

First, they say about "struct that defines both ", but in the second case the
struct doesn't define neither. The compiler generates something, and we can
suppose that compiler can generate something good. For example a new style copy
constructor. And it should generate it instead of postblit. Why? because the
second:

Second, "For backward compatibility reasons". The reason is backward
compatibility, not something else.

I mean that "struct that defines both" should be understood as "struct that
_explicilty_ defines both".

So, even with the current spec, this can work, and if it can work, then it
should work.

--


More information about the Digitalmars-d-bugs mailing list