lovely compiler error message - incompatible types

Laeeth Isharc via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jul 2 14:27:59 PDT 2015


On Thursday, 2 July 2015 at 21:19:19 UTC, Justin Whear wrote:
> On Thu, 02 Jul 2015 21:03:37 +0000, Laeeth Isharc wrote:
>
>>> Can you post the signature to the operator overload? I have 
>>> an idea of what it might be, but it's difficult to explain 
>>> without context.
>>>
>>> -Steve
>> 
>> https://gist.github.com/Laeeth/6251fa731e4cee84bcdc
>> 
>> not really a proper implementation.  I wanted something as a 
>> placeholder today that I could implement properly later...
>
> I think the issue is that your opBinary requires that 
> isNumeric!T be true.  This is the case if FixedDecimal is 
> allowed to decay to the underlying int which is why it works 
> when you use the alias this.  I recommend removing the alias 
> this and adding another overload like this:
>
> FixedDecimal opBinary(string s, T : FixedDecimal)(const T rhs)

Thanks v much !  Of course I guess it isn't numeric to the 
compiler...



More information about the Digitalmars-d-learn mailing list