[Issue 21317] New: Copy constructor defined but blitting still occurs
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Oct 16 07:28:48 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=21317
Issue ID: 21317
Summary: Copy constructor defined but blitting still occurs
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: eyal at weka.io
When defining a copy constructor, lack of NRVO (#21316) can still cause
implicit blitting, despite the DIP[1] claiming: "When a copy constructor is
defined for a struct, all implicit blitting is disabled for that struct".
For example, this program (same as #21316 but with a copy constructor):
import std.stdio;
struct S {
this(int x) { writefln("%s", &this); }
~this() { writefln("%s", &this); }
this(scope ref return S) {}
}
unittest {
auto f() { return S(1); }
auto x = f();
}
Still does blit/copy, silently.
[1] https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1018.md
--
More information about the Digitalmars-d-bugs
mailing list