aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-08-12 00:57:17 +0000
committerJohn McCall <rjmccall@apple.com>2010-08-12 00:57:17 +0000
commitfcadea2556be268121a6216e367bbe3598c4008e (patch)
treeb8e7feef78ec9c0680d4fa3b459bcdd9c16a7d04 /lib/Sema/SemaDecl.cpp
parenta77a723489b0cff63bf90f23416e10b8b6fc1f55 (diff)
Fix a crash on invalid when declaring an implicit member of a class with an
invalid destructor. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110891 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r--lib/Sema/SemaDecl.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index de7ad3d791..b27f727b3c 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -3652,8 +3652,14 @@ void Sema::CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD,
bool &Redeclaration,
bool &OverloadableAttrRequired) {
// If NewFD is already known erroneous, don't do any of this checking.
- if (NewFD->isInvalidDecl())
+ if (NewFD->isInvalidDecl()) {
+ // If this is a class member, mark the class invalid immediately.
+ // This avoids some consistency errors later.
+ if (isa<CXXMethodDecl>(NewFD))
+ cast<CXXMethodDecl>(NewFD)->getParent()->setInvalidDecl();
+
return;
+ }
if (NewFD->getResultType()->isVariablyModifiedType()) {
// Functions returning a variably modified type violate C99 6.7.5.2p2