www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14254] New: Append to upvalue in destructor segfaults when

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 puremagic.com
          Reporter: jakobovrum 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.

--
Mar 07 2015