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



--- Comment #1 from bearophile_h...@eml.cc 2010-03-18 14:30:25 PDT ---
This shows why requiring a bool as return value of opEquals is necessary for
generic code too (adapted from an idea of Bill Baxter):


import std.c.stdio: printf;
struct Foo {
    int x;
    int opEquals(T:Foo)(T other) {
        printf("****\n");
        return this.x - other.x;
    }
}
bool bar(T)(T f1, T f2) {
    // return f1 == f2;  // ERR
    return !!(f1 == f2); // OK, but silly
}
void main() {
    bool r = bar(Foo(1), Foo(2));
}

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

Reply via email to