www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13239] New: Code is generated for unused lazy expressions

https://issues.dlang.org/show_bug.cgi?id=13239

          Issue ID: 13239
           Summary: Code is generated for unused lazy expressions
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: bugzilla digitalmars.com

Given the code:

---
void log(A...)(lazy A args) { }

int fun(string[] args) {
  log("hello " ~ args[0]);
  return 43;
}
---

Code is generated for ("hello " ~ args[0]) even though it is unused. This can
cause significant unwanted code bloat.

--
Aug 01 2014