www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13352] New: Algebraic does not support binary arithmetic when

https://issues.dlang.org/show_bug.cgi?id=13352

          Issue ID: 13352
           Summary: Algebraic does not support binary arithmetic when
                    omitting small number types
           Product: D
           Version: D2
          Hardware: Other
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: Phobos
          Assignee: nobody puremagic.com
          Reporter: sludwig outerproduct.org

For example, when defining Algebraic!(long) and then trying to add two such 
values, or an algebraic with a raw number, opArithmetic will try to instantiate 
an Algebraic!(long) with an int, which fails compilation.

---
alias TP = Algebraic!(long);
auto a = TP(1L);
auto b = TP(2L);
assert(a + b == 3L); // error
assert(a + 2 == 3L); // error
assert(1 + b == 3L); // error
---

--
Aug 22 2014