[Issue 11506] New: pure evaluation should be shortcircuited

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Nov 12 13:44:16 PST 2013


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: nobody at puremagic.com
        ReportedBy: andrei at erdani.com


--- Comment #0 from Andrei Alexandrescu <andrei at erdani.com> 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: -------


More information about the Digitalmars-d-bugs mailing list