[PATCH] D108021: [dllexport] Instantiate default ctor default args

Peter Jiachen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 13 02:06:08 PDT 2021


peterjc123 created this revision.
peterjc123 added a reviewer: rnk.
peterjc123 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Fixes https://bugs.llvm.org/show_bug.cgi?id=51414.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108021

Files:
  clang/lib/Sema/SemaDeclCXX.cpp


Index: clang/lib/Sema/SemaDeclCXX.cpp     
===================================================================
--- clang/lib/Sema/SemaDeclCXX.cpp     
+++ 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<CXXConstructorDecl>(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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108021.366219.patch
Type: text/x-patch
Size: 794 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210813/add74cb8/attachment.bin>


More information about the cfe-commits mailing list