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

           Summary: Regression: assignment at declaration no longer
                    supports opAssign or ctor overloads
           Product: D
           Version: 2.033
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: sandf...@jhu.edu


--- Comment #0 from Rob Jacques <sandf...@jhu.edu> 2009-10-05 20:45:10 PDT ---
In DMD 2.032, when a struct was assigned to at it's declaration point, opAssign
overloads were called if other alternative were not available. In DMD 2.033,
neither opAssign or ctor overloads are called, only static opCall works

struct Foo {
    int x;
//    static opCall(int v) { // Un-comment this and the below works
//        Foo f;
//        f.x = v;
//        return f;
//    }
    this(int v){ x = v; }
    void opAssign(int v){
        x = v;
        return this;
    }
}

void main(char[][] args) {

    int y = 5;
    Foo f = y;  // fails
    f = y;      // okay
    f = Foo(y); // okay

}

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

Reply via email to