[Issue 13182] New: extern(C++) classes cause crash when allocated on the stack with scope

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Jul 22 01:48:30 PDT 2014


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 at gmail.com
          Reporter: yebblies at 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.

--


More information about the Digitalmars-d-bugs mailing list