July 02, 2019 [Issue 20021] New: `static if` doesn't evaluate `opCast(T : bool)` | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20021 Issue ID: 20021 Summary: `static if` doesn't evaluate `opCast(T : bool)` Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Keywords: rejects-valid Severity: normal Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: ag0aep6g@gmail.com Should compile: ---- struct S { bool opCast(T : bool)() { return true; } } void main() { static if (S.init) {} /* Error: expression (S).init of type S does not have a boolean value */ static if (!!S.init) {} /* no error */ if (S.init) {} /* no error */ } ---- -- |
Copyright © 1999-2021 by the D Language Foundation