www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19721] New: Cannot take address of scope local variable even

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

          Issue ID: 19721
           Summary: Cannot take address of scope local variable even with
                    dip1000 if a member variable is a delegate
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: atila.neves gmail.com

This code doesn't compile even with -dip1000 on dmd 2.085.0:


-----------------------------------
void main()  safe {
    scope s = Struct();
    func(&s);
}

private struct Struct {
    void delegate(int) dg;
}


void func(scope Struct* clientData)  safe nothrow {

}
-----------------------------------

It compiles if the `dg` member variable is removed or replaced with, say, an
int.

--
Mar 06 2019