www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22095] New: Closure not created or corrupted when accessing

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

          Issue ID: 22095
           Summary: Closure not created or corrupted when accessing
                    pointer in inline function
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Keywords: safe, wrong-code
          Severity: critical
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: dlang-bugzilla thecybershadow.net

///////////////// test.d /////////////////
struct S
{
    int[5] i; // must be 5 or greater
}

void main()
{
    void delegate() dg;

    (){
        S s = {[1,2,3,4,5]};
        auto pS = &s;
        dg = {
            assert(*pS == S([1,2,3,4,5]));
        };
    }();

    dg();
}
//////////////////////////////////////////

The assection

--
Jun 30 2021