www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21758] New: std.experimental.checkedint opBinaryRight with

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

          Issue ID: 21758
           Summary: std.experimental.checkedint opBinaryRight with integer
                    left-hand side does not compile for any operations
                    except + and -
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: n8sh.secondary hotmail.com

---
void main()
{
    import std.experimental.checkedint;

    assert(4 * checked(5L) == 20); // Fails to compile.
    assert(20 / checked(5L) == 4); // Fails to compile.
    assert(2 ^^ checked(3L) == 8); // Fails to compile.
    assert(12 % checked(5L) == 2); // Fails to compile.
    assert((0xff & checked(3L)) == 3); // Fails to compile.
    assert((0xf0 | checked(3L)) == 0xf3); // Fails to compile.
    assert((0xff ^ checked(5L)) == 0xf7); // Fails to compile.
}
---

--
Mar 24 2021