https://issues.dlang.org/show_bug.cgi?id=22768
Issue ID: 22768
Summary: lazy does not cache its results
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
import std;
void foo(lazy string s)
{
s.writeln;
s.writeln;
}
void main()
{
foo(() { 1.writeln; return `abc`; }());
}
This simple program outputs:
1
abc
1
abc
It should output instead:
1
abc
abc
--
