aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2009-12-02 07:16:50 +0000
committerEli Friedman <eli.friedman@gmail.com>2009-12-02 07:16:50 +0000
commit5fcf1f0df06e72581647efd579f970378f77eb55 (patch)
tree135a8101a2bd7c1e4af86fe416e08543f0cf1a2c /lib
parentf195357836e712b85591b22c47e63e327c657ceb (diff)
Fix another "operator delete missing" crash: make sure we don't check
isVirtual() before we've actually calculated whether the destructor is virtual. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90303 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Sema/SemaDecl.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 5d62ace907..b44d977b6a 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -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))