diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2011-05-20 05:57:18 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2011-05-20 05:57:18 +0000 |
commit | 645d958035d124b1698dc37af4186e78e1f264df (patch) | |
tree | ad251574fabd1ce1d5ffb31ea3864f927f68d573 /clang/lib/Sema/SemaExceptionSpec.cpp | |
parent | 8063a4a47a5ace1fc01c3bf843fd2bdfb504481a (diff) | |
download | bcm5719-llvm-645d958035d124b1698dc37af4186e78e1f264df.tar.gz bcm5719-llvm-645d958035d124b1698dc37af4186e78e1f264df.zip |
Fix PR9941 for out-of-line template destructors too.
llvm-svn: 131722
Diffstat (limited to 'clang/lib/Sema/SemaExceptionSpec.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExceptionSpec.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/clang/lib/Sema/SemaExceptionSpec.cpp b/clang/lib/Sema/SemaExceptionSpec.cpp index cd58f32fd48..fc204039604 100644 --- a/clang/lib/Sema/SemaExceptionSpec.cpp +++ b/clang/lib/Sema/SemaExceptionSpec.cpp @@ -701,13 +701,18 @@ 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; + if (getLangOptions().CPlusPlus0x && isa<CXXDestructorDecl>(New)) { + // Don't check uninstantiated template destructors at all. We can only + // synthesize correct specs after the template is instantiated. + if (New->getParent()->isDependentType()) + return false; + if (New->getParent()->isBeingDefined()) { + // 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), |