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


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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to