forked from OSchip/llvm-project
Fix another "operator delete missing" crash: make sure we don't check
isVirtual() before we've actually calculated whether the destructor is virtual. llvm-svn: 90303
This commit is contained in:
parent
df76fe45e6
commit
6393aac45e
|
@ -3240,8 +3240,6 @@ void Sema::CheckFunctionDeclaration(FunctionDecl *NewFD,
|
|||
Diag(NewFD->getLocation(), diag::err_destructor_name);
|
||||
return NewFD->setInvalidDecl();
|
||||
}
|
||||
|
||||
CheckDestructor(Destructor);
|
||||
}
|
||||
|
||||
Record->setUserDeclaredDestructor(true);
|
||||
|
@ -3265,6 +3263,12 @@ void Sema::CheckFunctionDeclaration(FunctionDecl *NewFD,
|
|||
AddOverriddenMethods(Method->getParent(), Method);
|
||||
}
|
||||
|
||||
// Additional checks for the destructor; make sure we do this after we
|
||||
// figure out whether the destructor is virtual.
|
||||
if (CXXDestructorDecl *Destructor = dyn_cast<CXXDestructorDecl>(NewFD))
|
||||
if (!Destructor->getParent()->isDependentType())
|
||||
CheckDestructor(Destructor);
|
||||
|
||||
// Extra checking for C++ overloaded operators (C++ [over.oper]).
|
||||
if (NewFD->isOverloadedOperator() &&
|
||||
CheckOverloadedOperatorDeclaration(NewFD))
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
// RUN: clang-cc %s -emit-llvm-only
|
||||
|
||||
struct A { virtual ~A(); };
|
||||
struct B : A {
|
||||
~B() { }
|
||||
};
|
||||
B x;
|
||||
|
Loading…
Reference in New Issue