[Issue 21997] New: CTFE should allow function pointer casts with different attributes
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Jun 6 16:53:45 UTC 2021
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: nobody at puremagic.com
Reporter: moonlightsentinel at disroot.org
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);
}
--
More information about the Digitalmars-d-bugs
mailing list