Reapply r121528, fixing PR9941 by delaying the exception specification check for destructors until the class is complete and destructors have been adjusted.

llvm-svn: 131632
This commit is contained in:
Sebastian Redl
2011-05-19 05:13:44 +00:00
parent 9eb5a410bd
commit 623ea82a6b
8 changed files with 236 additions and 21 deletions

View File

@@ -701,6 +701,14 @@ bool Sema::CheckExceptionSpecCompatibility(Expr *From, QualType ToType)
bool Sema::CheckOverridingFunctionExceptionSpec(const CXXMethodDecl *New,
const CXXMethodDecl *Old) {
if (getLangOptions().CPlusPlus0x && New->getParent()->isBeingDefined() &&
isa<CXXDestructorDecl>(New)) {
// The destructor might be updated once the definition is finished. So
// remember it and check later.
DelayedDestructorExceptionSpecChecks.push_back(std::make_pair(
cast<CXXDestructorDecl>(New), cast<CXXDestructorDecl>(Old)));
return false;
}
return CheckExceptionSpecSubset(PDiag(diag::err_override_exception_spec),
PDiag(diag::note_overridden_virtual_function),
Old->getType()->getAs<FunctionProtoType>(),