summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-12-05 11:34:06 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-12-05 11:34:06 +0000
commit3e284699d91b1649d00863adc8595a900956fa22 (patch)
treeed27b4432c67bce113a4a463af687ad679401600 /clang/lib/Sema/SemaDecl.cpp
parentf89e2e2583ce57df74c0a35bfeff1da2aca508c6 (diff)
downloadbcm5719-llvm-3e284699d91b1649d00863adc8595a900956fa22.tar.gz
bcm5719-llvm-3e284699d91b1649d00863adc8595a900956fa22.zip
In C++, if we hit an error in the class-head, don't try to parse the class body.
Our error recovery path may have made the class anonymous, and that has a pretty disastrous impact on any attempt to parse a class body containing constructors. llvm-svn: 169374
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 341e8feba61..102a6ae9a23 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -9299,7 +9299,9 @@ CreateNewDecl:
AddPushedVisibilityAttribute(New);
OwnedDecl = true;
- return New;
+ // In C++, don't return an invalid declaration. We can't recover well from
+ // the cases where we make the type anonymous.
+ return (Invalid && getLangOpts().CPlusPlus) ? 0 : New;
}
void Sema::ActOnTagStartDefinition(Scope *S, Decl *TagD) {
OpenPOWER on IntegriCloud