www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18592] New: Associative array assignment with a destructor


          Issue ID: 18592
           Summary: Associative array assignment with a destructor should
                    be  safe if the destructor is  safe
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: greensunny12 gmail.com

cat > main.d << EOF
void main()  safe
    struct ThrowingElement
        int i;

    ThrowingElement[int] aa;
    aa[0] = ThrowingElement(0);

The problem is that the generated opAssign is  system:

ref return  system ThrowingElement opAssign(ThrowingElement p)
        (ThrowingElement __swap2 = void;) , __swap2 = this , this = p ,
        return this;

Mar 11 2018