[Issue 24699] New: [REG2.108] No short-circuit evaluation of mixing template bool argument

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Aug 12 13:03:42 UTC 2024


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

          Issue ID: 24699
           Summary: [REG2.108] No short-circuit evaluation of mixing
                    template bool argument
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: johanengelen at weka.io

Testcase:
```
mixin template StaticAssertAt(bool cond) {
    static if (!cond) {
        pragma(msg, "asd");
    }
}

template foo(T) {
    enum foo = false;
    mixin StaticAssertAt!(true || T.tupleof.length == 1);
}

enum a = foo!ubyte;
```

The test case compiles with 2.107 but not with 2.108. The short-circuit
evaluation of || is not happening, thus 2.108 errors with:
Error: no property `tupleof` for type `ubyte`

https://d.godbolt.org/z/fYYYfhq95

--


More information about the Digitalmars-d-bugs mailing list