https://issues.dlang.org/show_bug.cgi?id=21997
Issue ID: 21997
Summary: CTFE should allow function pointer casts with
different attributes
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
The following works at runtime but is rejected during CTFE:
int nonPureFunc(int i)
{
return 2 * i;
}
void main()
{
auto pureFunc = cast(int function(int) pure) &nonPureFunc;
assert(pureFunc(2) == 4);
}
--