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: [email protected]
Reporter: [email protected]
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 */
}
----
--