[LLVMbugs] [Bug 15058] New: [-cxx-abi microsoft] Implement proper handling of virtual destructors

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jan 24 08:40:38 PST 2013


http://llvm.org/bugs/show_bug.cgi?id=15058

             Bug #: 15058
           Summary: [-cxx-abi microsoft] Implement proper handling of
                    virtual destructors
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: timurrrr at google.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Here's a repro which shows some things that currently go wrong.
--------------------------------------
$ cat with_cl.cpp
struct Base {
  virtual ~Base();
};

extern "C" int printf(const char *fmt, ...);

Base::~Base() {
  printf("OK: %s\n", __FUNCTION__);
}

void call_complete_dtor(Base* obj) {
  obj->~Base();
  printf("After obj->~Base();\n");
}
--------------------------------------
$ cat with_clang.cpp
struct Base {
  virtual ~Base();
};

extern "C" int printf(const char *fmt, ...);

struct Derived: Base {
  virtual ~Derived() {
    printf("OK: %s\n", __FUNCTION__);
  }
};

void call_complete_dtor(Base* obj);

int main() {
  call_complete_dtor(new Derived);
  printf("After call_complete_dtor\n");
}
--------------------------------------
$ cl -nologo -c with_cl.cpp with_clang.cpp && link -nologo with_cl.obj
with_clang.obj && ./with_cl.exe
OK: Derived::~Derived
OK: Base::~Base
After obj->~Base();
After call_complete_dtor

$ cl -nologo -c with_cl.cpp && \
  clang++ -Xclang -cxx-abi -Xclang microsoft -fno-rtti -c with_clang.cpp && \
  link -nologo with_cl.obj with_clang.o && ./with_cl.exe
OK: ~Derived
OK: Base::~Base
After obj->~Base();
Segmentation fault

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list