Fix crashes when creating global instances of polymorphic classes without fields

Reviewed at http://llvm-reviews.chandlerc.com/D1795

llvm-svn: 191839
This commit is contained in:
Timur Iskhodzhanov 2013-10-02 16:03:16 +00:00
parent 6df39438af
commit 40c585a568
2 changed files with 4 additions and 1 deletions

View File

@ -96,7 +96,8 @@ static void EmitDeclDestroy(CodeGenFunction &CGF, const VarDecl &D,
CXXDestructorDecl *dtor = record->getDestructor();
function = CGM.GetAddrOfCXXDestructor(dtor, Dtor_Complete);
argument = addr;
argument = llvm::ConstantExpr::getBitCast(
addr, CGF.getTypes().ConvertType(type)->getPointerTo());
// Otherwise, the standard logic requires a helper function.
} else {

View File

@ -1,4 +1,6 @@
// RUN: %clang_cc1 -emit-llvm-only %s -std=c++11
// RUN: %clang_cc1 -emit-llvm-only -fno-use-cxa-atexit %s -std=c++11
// RUN: %clang_cc1 -cxx-abi microsoft -fno-rtti -emit-llvm-only %s -std=c++11
// PR13479: don't crash with -fno-exceptions.
namespace {