Bug 6682 – Template function that has lazy parameter is not inferred as pure
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-09-16T14:17:00Z
Last change time
2011-09-17T14:04:33Z
Keywords
patch, rejects-valid
Assigned to
nobody
Creator
k.hara.pg
Comments
Comment #0 by k.hara.pg — 2011-09-16T14:17:37Z
By fixing bug 5750, the calcLazy should be inferred as pure, but it doesn't.
T calcLazy(T)(lazy T n)
{
return n;
}
int purefunc() pure
{
return calcLazy(1);
// test.d(8): Error: pure function 'purefunc' cannot call impure function 'calcLazy'
}
void main()
{
auto n = purefunc();
}