digitalmars.D - D2 opAssign conflict
- John C (12/12) Mar 08 2008 In the latest D2 release, if a struct implements a destructor, the
- Jarrett Billingsley (5/17) Mar 08 2008 Template functions and regular functions are supposed to overload agains...
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.
Mar 08 2008
"John C" <johnch_atms hotmail.com> wrote in message news:fqufog$2ncd$1 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.
Mar 08 2008