www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13182] New: extern(C++) classes cause crash when allocated on

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

          Issue ID: 13182
           Summary: extern(C++) classes cause crash when allocated on the
                    stack with scope
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Keywords: wrong-code
          Severity: blocker
          Priority: P1
         Component: DMD
          Assignee: yebblies gmail.com
          Reporter: yebblies gmail.com

extern(C++)
class C
{
}

void main()
{
    scope C c = new C();
}

This crashes because dmd inserts 'delete c;' for the scope variable and delete
assumes that classinfo.

As destructors are not currently supported for C++ classes, it should not call
delete at all.

--
Jul 22 2014