[Issue 21758] New: std.experimental.checkedint opBinaryRight with integer left-hand side does not compile for any operations except + and -

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 24 13:40:58 UTC 2021


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 at puremagic.com
          Reporter: n8sh.secondary at 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.
}
---

--


More information about the Digitalmars-d-bugs mailing list