diff options
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index e9e0f5e214d..c8973ae100e 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -13386,7 +13386,14 @@ CreateNewDecl: OwnedDecl = true; // 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) ? nullptr : New; + if (Invalid && getLangOpts().CPlusPlus) { + if (New->isBeingDefined()) + if (auto RD = dyn_cast<RecordDecl>(New)) + RD->completeDefinition(); + return nullptr; + } else { + return New; + } } void Sema::ActOnTagStartDefinition(Scope *S, Decl *TagD) { |