Bug 6280 – [CTFE] Cannot put 'in' expression of AA in an 'if' condition
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
All
Creation time
2011-07-10T04:16:00Z
Last change time
2011-07-26T15:18:16Z
Keywords
rejects-valid
Assigned to
nobody
Creator
kennytm
Comments
Comment #0 by kennytm — 2011-07-10T04:16:22Z
Test case:
--------------------------------
static assert({
if (0 in [0:0]) {}
return true;
}());
--------------------------------
x.d(4): Error: cannot evaluate delegate pure nothrow bool()
{
if (0 in [0:0])
{
}
return true;
}
() at compile time
x.d(1): Error: static assert (delegate pure nothrow bool()
{
if (0 in [0:0])
{
}
return true;
}
()) is not evaluatable at compile time
--------------------------------
Calling 'if((a in b) !is null)' can workaround the problem.