[Issue 10263] New: Refused class opBinary by ref

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jun 4 04:55:47 PDT 2013


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

           Summary: Refused class opBinary by ref
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: diagnostic, rejects-valid
          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 2013-06-04 04:55:45 PDT ---
class Foo {
    Foo opBinary(string op)(ref Foo) {
        return null;
    }
}
void main() {
    auto f = new Foo;
    auto r1 = f * f;         // OK
    auto r2 = f * (new Foo); // Error.
}



DMD 2.064alpha gives:

test.d(9): Error: 'f' is not of arithmetic type, it is a test.Foo
test.d(9): Error: 'new Foo' is not of arithmetic type, it is a test.Foo


I think that's a bug. Even if that's not a bug, then I suggest to improve the
error messages.

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