[Issue 13352] New: Algebraic does not support binary arithmetic when omitting small number types

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Aug 22 02:26:41 PDT 2014


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 at puremagic.com
          Reporter: sludwig at 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
---

--


More information about the Digitalmars-d-bugs mailing list