www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17397] New: Lazy attribute propagation incorrect

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

          Issue ID: 17397
           Summary: Lazy attribute propagation incorrect
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: eyal weka.io

In continuation to https://issues.dlang.org/show_bug.cgi?id=16540, these are
still buggy:

void foo(scope lazy int* f)  nogc {}
void vararg_foo(Args...)(scope lazy Args args)  nogc {}

// Compiles fine
void bar1()  nogc { foo(new int(5)); }

// Incorrectly fails!
void bar2()  nogc {
    int* f() { return new int(5); }
    foo(f()); // f() should not be called here!
}

// Incorrectly fails!
void bar3(scope lazy int* x)  nogc {
    vararg_foo(x); // x should not be evaluated here!
}

--
May 14 2017