lovely compiler error message - incompatible types
Justin Whear via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Jul 2 14:19:19 PDT 2015
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)
More information about the Digitalmars-d-learn
mailing list