[Issue 3659] New: Too much exegesis on opEquals

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Dec 30 09:14:07 PST 2009


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

           Summary: Too much exegesis on opEquals
           Product: D
           Version: unspecified
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: andrei at metalanguage.com


--- Comment #0 from Andrei Alexandrescu <andrei at metalanguage.com> 2009-12-30 09:14:06 PST ---
struct A {
    bool opEquals(int x) {
        return false;
    }
}

Compiler says:

Error: function test.A.opEquals type signature should be const bool(ref
const(A)) not bool(int x)

The compiler should accept any signature for opEquals. All it needs to do is
rewrite a == b into a.opEquals(b) or b.opEquals(a).

For classes I'm doubtful that opEquals needs to be const.

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