Bug 8689 – Variant opArithmetic does not attempt float conversion
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-09-18T13:27:00Z
Last change time
2013-01-02T00:28:32Z
Assigned to
nobody
Creator
callumenator
Comments
Comment #0 by callumenator — 2012-09-18T13:27:20Z
Variant tries to mimic D's built-in rules for arithmetic
conversions but:
import std.variant, std.stdio;
void main()
{
auto v1 = Variant(4.5f);
auto v2 = Variant(3.5f);
writeln((v1+v2).type()); // double (should be float)
}
The reason is Variant doesn't try to convert to float in
opArithmetic. I have submitted a pull request fixing this.
Comment #1 by github-bugzilla — 2012-09-28T06:40:48Z