[Issue 1792] illegal opAssign possible via alias

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Sep 9 14:21:49 PDT 2008


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


smjg at iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg at iname.com




------- Comment #1 from smjg at iname.com  2008-09-09 16:21 -------
The compiler accepts the code, but the assignment operator doesn't actually
overload:
----------
import std.stdio;

class C {
    C set(C c) {
        writefln("Calling C.set");
        return c;
    }
    alias set opAssign;
}

void main() {
    C d = new C;
    C e = new C;
    d = e;
}
----------
generates no output on run.


-- 



More information about the Digitalmars-d-bugs mailing list