diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 341e8feba6..102a6ae9a2 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/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) { |