diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -6005,6 +6005,15 @@ if (TSK == TSK_ImplicitInstantiation && !ClassAttr->isInherited()) continue; + // If this is an MS ABI dllexport default constructor, instantiate any + // default arguments. + if (S.Context.getTargetInfo().getCXXABI().isMicrosoft()) { + auto CD = dyn_cast(MD); + if (CD && CD->isDefaultConstructor()) { + S.InstantiateDefaultCtorDefaultArgs(CD); + } + } + S.MarkFunctionReferenced(Class->getLocation(), MD); // The function will be passed to the consumer when its definition is