import core.memory; void main() { struct S { int x; this(this) @disable; ~this() @safe pure nothrow @nogc {} } S* p; // rvalue p = moveToGC(S(123)); assert(p.x == 123); // lvalue auto lval = S(456); p = moveToGC(lval); assert(p.x == 456); assert(lval.x == 0); }
The following compiles with dmd but not with ldc on run.dlang.io.
Am I doing something wrong?
- moveToGC JG via Digitalmars-d-learn
- Re: moveToGC Mike Parker via Digitalmars-d-learn
- Re: moveToGC JG via Digitalmars-d-learn
- Re: moveToGC Alain De Vos via Digitalmars-d-learn