[Issue 5893] Allow simple aliases for operator overloading

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jan 21 18:35:24 PST 2012


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


timon.gehr at gmx.ch changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |timon.gehr at gmx.ch


--- Comment #2 from timon.gehr at gmx.ch 2012-01-21 18:35:23 PST ---
1. The static if in the function body is not required. You can return a void
expression from a void function.
2. Here is what still does not work:

class C{
    void concatAssign(C other) { }
    void concatAssign(short other) { }
    void concatAssign(short[] other) { }

    auto ref opOpAssign(string s, T)(T t) if (s == "~"){
        return concatAssign(t);
    }
}

void main()
{
    auto c = new C;
    c.opOpAssign!"~"(c); // works
    c.opOpAssign!"~"(1); // no go
    c ~= 1;              // no go
    c ~= [1,2,3];        // no go

    // (compare to)
    short[] s;
    s ~= 1;       // works
    s ~= [1,2,3]; // works
}

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