D2 opAssign conflict

Jarrett Billingsley kb3ctd2 at yahoo.com
Sat Mar 8 09:19:44 PST 2008


"John C" <johnch_atms at hotmail.com> wrote in message 
news:fqufog$2ncd$1 at digitalmars.com...
> 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.

Template functions and regular functions are supposed to overload agains 
each other in D2, but I'm not sure if that's implemented yet.  If/when it's 
implemented I'd imagine that it'd work. 





More information about the Digitalmars-d mailing list