Proxy addition

Dan dbdavidson at yahoo.com
Thu Oct 25 09:39:56 PDT 2012


 From bug tracker I see that Proxy has a few issues, so this has 
likely been seen. But what would cause this error?

tmp/c.d(16): Error: overloads pure nothrow @safe double(auto ref 
CcRate b) and pure nothrow @safe double(auto ref CcRate b) both 
match argument list for opBinary

The error refers to two methods with the same signature. In 
typecons there are only two "Binary" methods, opBinary and 
opBinaryRight, both in Proxy, so where is the 
duplication/conflict coming from?

Thanks
Dan
---------------
import std.stdio;
import std.typecons;
import std.algorithm;

struct CcRate {
   private double rate = 0;
   mixin Proxy!rate;

   this(double rate) {
     this.rate = rate;
   }
}

unittest {
     CcRate r1 = 0.033, r2 = 0.002;
     writeln(r1+r2);  // compile error
}
---------------


More information about the Digitalmars-d-learn mailing list