diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp --- a/clang/lib/AST/ASTImporter.cpp +++ b/clang/lib/AST/ASTImporter.cpp @@ -2801,7 +2801,7 @@ if (D->isAnonymousStructOrUnion()) D2->setAnonymousStructOrUnion(true); - if (D->isCompleteDefinition()) + if (!Importer.isMinimalImport() && D->isCompleteDefinition()) if (Error Err = ImportDefinition(D, D2, IDK_Default)) return std::move(Err); @@ -3440,6 +3440,9 @@ if (ToInitializer) ToField->setInClassInitializer(ToInitializer); ToField->setImplicit(D->isImplicit()); + if (CXXRecordDecl *FieldType = D->getType()->getAsCXXRecordDecl()) + if (Error Err = ImportDefinitionIfNeeded(FieldType)) + return std::move(Err); LexicalDC->addDeclInternal(ToField); return ToField; } @@ -5323,7 +5326,7 @@ D2->setTemplateSpecializationKind(D->getTemplateSpecializationKind()); - if (D->isCompleteDefinition()) + if (!Importer.isMinimalImport() && D->isCompleteDefinition()) if (Error Err = ImportDefinition(D, D2)) return std::move(Err);