[Issue 11355] Copy through alias this with @disabled this(this)

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Jul 8 07:40:11 PDT 2014


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

Nick Treleaven <ntrel-public at yahoo.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ntrel-public at yahoo.co.uk

--- Comment #1 from Nick Treleaven <ntrel-public at yahoo.co.uk> ---
I think the move line should be disallowed:

A a = move(b);    // implicit copy, currently allowed
A a = move(b).a;  // currently disallowed by @disable this(this)

(The second line is equivalent, just expanding via alias this).

I think this test case may be the same bug:

struct A {
    @disable this(this); // Prevent copying
}

struct B {
    A a;
    alias a this;
}

void main() {
    A a = B(); // implicit copy of temporaryB.a should be disallowed
}

--


More information about the Digitalmars-d-bugs mailing list