[Issue 20021] New: `static if` doesn't evaluate `opCast(T : bool)`
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jul 2 10:17:23 UTC 2019
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 at puremagic.com
Reporter: ag0aep6g at 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 */
}
----
--
More information about the Digitalmars-d-bugs
mailing list