[Issue 19185] New: [ICE] Nested struct segfaults when using variable from outer scope

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Aug 22 14:06:26 UTC 2018


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

          Issue ID: 19185
           Summary: [ICE] Nested struct segfaults when using variable from
                    outer scope
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: razvan.nitu1305 at gmail.com

void fun()
{
    int x = 2;
    struct A
    {   
        int a;
        this(int a)
        {   
            this.a = a + x;      // segault here
        }
    }

    A a = 5;
    // A a = A(5); initializing `a` like this works as expected                 
}

void main()
{
    fun();
}

--


More information about the Digitalmars-d-bugs mailing list