https://d.puremagic.com/issues/show_bug.cgi?id=11506
Summary: pure evaluation should be shortcircuited
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P2
Component: DMD
AssignedTo: [email protected]
ReportedBy: [email protected]
--- Comment #0 from Andrei Alexandrescu <[email protected]> 2013-11-12 13:44:14
PST ---
Consider:
pure int fun()
{
for (;;) {}
return 42;
}
int main(string[] args)
{
return fun(), cast(int) args.length;
}
This program never ends. It should not evaluate fun() at all. Also:
pure int fun();
int main(string[] args)
{
return fun() + fun();
}
This program doesn't link, but the generated code reveals that fun() is called
twice. It should only called once.
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------