PR10566: Make sure codegen for deleting an pointer to an incomplete type actually works.

llvm-svn: 136703
This commit is contained in:
Eli Friedman 2011-08-02 18:05:30 +00:00
parent be10f9853c
commit b23533db13
2 changed files with 6 additions and 4 deletions

View File

@ -1206,7 +1206,7 @@ static void EmitObjectDelete(CodeGenFunction &CGF,
const CXXDestructorDecl *Dtor = 0;
if (const RecordType *RT = ElementType->getAs<RecordType>()) {
CXXRecordDecl *RD = cast<CXXRecordDecl>(RT->getDecl());
if (!RD->hasTrivialDestructor()) {
if (RD->hasDefinition() && !RD->hasTrivialDestructor()) {
Dtor = RD->getDestructor();
if (Dtor->isVirtual()) {

View File

@ -125,9 +125,11 @@ namespace test4 {
namespace test5 {
struct Incomplete;
// CHECK: define void @_ZN5test523array_delete_incompleteEPNS_10IncompleteE
void array_delete_incomplete(Incomplete *p) {
// CHECK: define void @_ZN5test523array_delete_incompleteEPNS_10IncompleteES1_
void array_delete_incomplete(Incomplete *p1, Incomplete *p2) {
// CHECK: call void @_ZdlPv
delete p1;
// CHECK: call void @_ZdaPv
delete [] p;
delete [] p2;
}
}