[Issue 3694] Template this parameters don't work with operator overloads
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Mar 4 16:23:12 PST 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3694
gareth.charnock at gmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |gareth.charnock at gmail.com
--- Comment #1 from gareth.charnock at gmail.com 2010-03-04 16:23:09 PST ---
I can confirm this bug is still present in DMD 2.040. Test case used:
struct ddouble(int l,int m /*other SI dimensions would go here*/) {
this(double _val) {val=val;}
ddouble!(l+l2,m+m2) opMult(int l2,int m2)(ddouble!(l2,m2) oprand) {
return ddouble!(l+l2,m+m2)(val*oprand.val);
}
ddouble!(l+l2,m+m2) mult(int l2,int m2)(ddouble!(l2,m2) oprand) {
return ddouble!(l+l2,m+m2)(val*oprand.val);
}
/* /,-,+ operators would go here */
double val;
};
void main() {
ddouble!(1,0) length=ddouble!(1,0)(1.0);
ddouble!(0,1) mass =ddouble!(0,1)(1.0);
auto t2=length.mult(mass); //Works
auto t3=length*mass; //Error
}
testcase.d(28): Error: incompatible types for ((length) * (mass)):
'ddouble!(1,0)' and 'ddouble!(0,1)'
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list