www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17456] New: [REG2.075a] spurious lifetime diagnostic on

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

          Issue ID: 17456
           Summary: [REG2.075a] spurious lifetime diagnostic on delegates
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: b2.temp gmx.com

repro:


===
struct Foo
{
    private void delegate() dg;
    void assign()  safe {dg = &sameThis;}
    void sameThis(){}
}
===

yield: "address of variable this assigned to this with longer lifetime"

But the delegate is never escaped and the context pointer and the this have the
same lifetime.

--
May 30 2017