digitalmars.D.bugs - [Issue 16131] New: A struct is being copied unnecessarily when
- via Digitalmars-d-bugs (30/30) Jun 06 2016 https://issues.dlang.org/show_bug.cgi?id=16131
https://issues.dlang.org/show_bug.cgi?id=16131 Issue ID: 16131 Summary: A struct is being copied unnecessarily when initialized 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 Even when the struct disallows copying, it is being temporarily created and copied. This reproduces on both dmd and ldc2. Reproducing example: struct Foo { disable this(this); this(out Foo *x) { x = &this; } } void main() { Foo *x; auto a = Foo(x); assert(x == &a); // OK Foo b; b = Foo(x); assert(x == &b); // FAILS } --
Jun 06 2016