[Issue 14254] New: Append to upvalue in destructor segfaults when struct is CT-initialized

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Mar 7 10:54:06 PST 2015


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

          Issue ID: 14254
           Summary: Append to upvalue in destructor segfaults when struct
                    is CT-initialized
           Product: D
           Version: D2
          Hardware: x86
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: jakobovrum at gmail.com

The following segfaults in _d_arrayappendcTX:
---
unittest
{
    int[] upvalue;

    struct S
    {
        ~this()
        { 
            upvalue ~= 0; // segfault
        }
    }

    struct Outer
    {
        S s2 = S();
    }

    {
        Outer outer;
    } // destructor called here
}
---
I guess either this code is accepts-invalid or some other bug.

--


More information about the Digitalmars-d-bugs mailing list