[Issue 6588] Struct d'tors + immutable elements doesn't work

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Sep 3 07:03:29 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=6588



--- Comment #1 from Kenji Hara <k.hara.pg at gmail.com> 2011-09-03 07:03:19 PDT ---
This is built-in opAssign issue.

When struct has only dtor, built-in opAssign is implemented automatically by
compiler with memberwise assign.

struct Task(Args...) {

    Args _args;

    this(Args args) {
        _args = args;
    }

    ~this() {}  // Bug goes away without this.

    // Inserted automatically by compiler.
    // This code does not have file positions, so error message displays
    // no position.
    ref typeof(this) opAssign(typeof(this) rhs)
    {
        this._args = rhs.args;
        // immutable field assign outside constructor causes error
        return this;
    }
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list