[Issue 14155] [REG2.066] A defect in DIP29: the return value of some pure functions cannot be unique pointer

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Feb 9 05:19:29 PST 2015


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

--- Comment #1 from Kenji Hara <k.hara.pg at gmail.com> ---
Related case with NewExpression.

immutable int g;
static this() { g = 1; }
class C
{
    int* p;
    this(int) immutable pure { p = &g; }
}
void main()
{
    C c = new immutable C(1);
    *c.p = 2;
    assert(g == 2);   // blam!
}

--


More information about the Digitalmars-d-bugs mailing list