D2 opAssign conflict

John C johnch_atms at hotmail.com
Sat Mar 8 08:43:54 PST 2008


In the latest D2 release, if a struct implements a destructor, the 
compiler automatically defines an opAssign. Unfortunately this causes 
conflicts with user-defined, templated opAssigns.

struct Value {

   void opAssign(T)(T value) {}

   ~this() {}

}

Error: function Value.opAssign conflicts with template Value.opAssign(T)

The first opAssign in the error message is the compiler-generated one. 
If I define multiple non-templated opAssigns, the problem goes away - 
shouldn't we be allowed to have it both ways?

John.



More information about the Digitalmars-d mailing list