[Issue 20965] Implicitly generated postblit overrides disabled copy ctor

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jun 25 05:03:25 UTC 2020


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

RazvanN <razvan.nitu1305 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |razvan.nitu1305 at gmail.com

--- Comment #1 from RazvanN <razvan.nitu1305 at gmail.com> ---
You are correct, however, the initial idea was to favor the use of postblits
until they are deprecated. If you want to make sure that all copying is
disabled, simply do:

@disable this(this);
@disable this(ref typeof(this));

You don't have to reflect on any code this way.

The rule of thumb is: if you want to make sure that a posblit does not get in
your way you must defensively disable the postblit and then the copy
constructor will have priority.

--


More information about the Digitalmars-d-bugs mailing list