aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaExceptionSpec.cpp
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2011-05-20 05:57:18 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2011-05-20 05:57:18 +0000
commita0448264c7da395ca9416c6570bc43a7f49e436b (patch)
tree6546a7f042630aa269397635347fc8cedf2ad69c /lib/Sema/SemaExceptionSpec.cpp
parent1e55e91a257c4ddd4364656b048a3c345c366804 (diff)
Fix PR9941 for out-of-line template destructors too.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131722 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExceptionSpec.cpp')
-rw-r--r--lib/Sema/SemaExceptionSpec.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/Sema/SemaExceptionSpec.cpp b/lib/Sema/SemaExceptionSpec.cpp
index cd58f32fd4..fc20403960 100644
--- a/lib/Sema/SemaExceptionSpec.cpp
+++ b/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),