[Issue 5609] struct opEquals doesn't conform to language specifications.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Apr 22 16:22:34 PDT 2012


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


SomeDude <lovelydear at mailmetrash.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lovelydear at mailmetrash.com


--- Comment #2 from SomeDude <lovelydear at mailmetrash.com> 2012-04-22 16:23:34 PDT ---
Code in the attachment:

struct A
{
    int x;

    A foo()
    {
        return A(x);
    }

    const bool opEquals(ref const A other)
    {
        return (x == other.x);
    }
}

void main()
{
    auto a = A(5);
    assert(a.foo == a); // OK
    assert(a == a.foo); // Error
}

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