Permalink
Browse files

Merge pull request #805 from callumenator/master

Fix for issue 8689, Variant doesn't attempt float conversion in opArithmetic
  • Loading branch information...
2 parents 07765d1 + 3bd4e2a commit d94803416b683e4aa693c92133c258e8cfc730d6 @andralex andralex committed Sep 28, 2012
Showing with 4 additions and 0 deletions.
  1. +4 −0 std/variant.d
View
@@ -813,6 +813,8 @@ public:
result = mixin("get!(ulong) " ~ op ~ " other.get!(ulong)");
else if (convertsTo!(long) && other.convertsTo!(long))
result = mixin("get!(long) " ~ op ~ " other.get!(long)");
+ else if (convertsTo!(float) && other.convertsTo!(float))
+ result = mixin("get!(float) " ~ op ~ " other.get!(float)");
else if (convertsTo!(double) && other.convertsTo!(double))
result = mixin("get!(double) " ~ op ~ " other.get!(double)");
else
@@ -829,6 +831,8 @@ public:
result = mixin("get!(ulong) " ~ op ~ " other");
else if (is(typeof(T.max) : long) && T.min < 0 && convertsTo!(long))
result = mixin("get!(long) " ~ op ~ " other");
+ else if (is(T : float) && convertsTo!(float))
+ result = mixin("get!(float) " ~ op ~ " other");
else if (is(T : double) && convertsTo!(double))
result = mixin("get!(double) " ~ op ~ " other");
else

0 comments on commit d948034

Please sign in to comment.