October 16, 2020 [Issue 21317] New: Copy constructor defined but blitting still occurs | ||||
---|---|---|---|---|
| ||||
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@puremagic.com Reporter: eyal@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 -- |
Copyright © 1999-2021 by the D Language Foundation