Bug 14049 – [REG2.064] Wrong purity inference for nested lambda
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-01-26T13:09:00Z
Last change time
2015-01-28T10:59:41Z
Keywords
accepts-invalid, pull, wrong-code
Assigned to
nobody
Creator
k.hara.pg
Comments
Comment #0 by k.hara.pg — 2015-01-26T13:09:23Z
This code is correctly rejected with 2.063, but wrongly accepted with 2.064 - git-head.
auto impure() { return 1; }
void foo(T)(T val)
{
auto n = ()@trusted{
return impure();
}();
}
void bar() pure
{
foo(1); // line 12
}
With 2.063:
test.d(12): Error: pure function 'bar' cannot call impure function 'foo'