[Issue 19235] New: Repeatedly calling non-pure function in non-pure literal nested in pure function is broken
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Sep 8 12:38:18 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=19235
Issue ID: 19235
Summary: Repeatedly calling non-pure function in non-pure
literal nested in pure function is broken
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: johannespfau at gmail.com
The test case is much simpler than the title:
-------------------------------------------------
struct FloatingPointControl
{
void foo() pure
{
auto impl = function bool() {
setControlState(0);
setControlState(0);
return 0;
};
}
private:
static void setControlState(uint newState)
{
}
}
-------------------------------------------------
dmd -c test.d
test.d(7): Error: pure function test.FloatingPointControl.foo cannot call
impure function test.FloatingPointControl.setControlState
Comment one of the setControlState calls and the test case compiles.
--
More information about the Digitalmars-d-bugs
mailing list