www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17872] New: 'lazy' on variadic template parameters is ignored


          Issue ID: 17872
           Summary: 'lazy' on variadic template parameters is ignored
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: simen.kjaras gmail.com

This assert fails:

void foo(T...)(lazy T args) {}

unittest {
    int n = 3;
    assert(n == 3); // Fails, n == 4.

This means there is no way to mark an arbitrary number of arguments of unknown
types as lazy. A workaround exists for limited numbers, where (T1, T2, T3) is
used in place of T..., but this solution does not scale.

Oct 01 2017