D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6682 - Template function that has lazy parameter is not inferred as pure
Summary: Template function that has lazy parameter is not inferred as pure
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: patch, rejects-valid
Depends on:
Blocks:
 
Reported: 2011-09-16 14:17 UTC by Kenji Hara
Modified: 2011-09-17 14:04 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Kenji Hara 2011-09-16 14:17:37 UTC
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();
}