[Issue 10567] Typeinfo.compare has unreasonable signature requirements on opCmp

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Aug 5 02:54:10 PDT 2013


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



--- Comment #10 from Kenji Hara <k.hara.pg at gmail.com> 2013-08-05 02:54:04 PDT ---
(In reply to comment #9)
> Hi Kenji,
> 
> It seems that the latest pull has fixed this bug. Is there anything else that
> must be fixed? (You mentioned that this was only a "partial" fix?)

The remain issue is that does not detect alias this opCmp correctly.

struct X
{
    int opCmp(X) { return 0; }
}
struct S
{
    int val;
    X x;
    alias x this;
}
void main()
{
    S s1 = S(1);
    S s2 = S(2);
    assert(!(s1 < s2) && !(s1 > s2));   // OK
    assert(s1.opCmp(s2) == 0);          // OK
    assert(typeid(S).compare(&s1, &s2) == 0);   // doesn't work
}

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