[Issue 4258] New: "auto ref" doesn't work in one or more cases

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jun 1 10:11:17 PDT 2010


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

           Summary: "auto ref" doesn't work in one or more cases
           Product: D
           Version: unspecified
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2010-06-01 10:11:15 PDT ---
I think this is a correct D2 program:


struct Vec {
    Vec opOpAssign(string Op)(auto ref Vec other) if (Op == "+=") {
        return this;
    }
    Vec opBinary(string Op:"+")(Vec other) {
        Vec result;
        return result += other;
    }
}
void main() {
    Vec v;
    v += Vec() + Vec(); // line 12
}


But DMD v2.046 prints:
temp.d(12): Error: function temp.Vec.opOpAssign!("+=").opOpAssign (auto ref Vec
other) is not callable using argument types (Vec)
temp.d(12): Error: (Vec()).opBinary((Vec())) is not an lvalue

-- 
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