================
@@ -6604,13 +6617,42 @@ void Sema::checkClassLevelDLLAttribute(CXXRecordDecl
*Class) {
if (MD->isDeleted())
continue;
+ // Don't export inherited constructors whose parameters prevent ABI-
+ // compatible forwarding thunk. When canEmitDelegateCallArgs (in
+ // CodeGen) returns false, Clang inlines the constructor body instead
+ // of emitting a forwarding thunk, producing code that is not ABI-
+ // compatible with MSVC. Suppress the export so the user gets a linker
+ // error rather than a silent runtime mismatch.
+ if (ClassExported) {
+ if (auto *CD = dyn_cast<CXXConstructorDecl>(MD)) {
+ if (CD->getInheritedConstructor()) {
+ if (CD->isVariadic())
+ continue;
+ if (Context.getTargetInfo()
+ .getCXXABI()
+ .areArgsDestroyedLeftToRightInCallee()) {
+ bool HasCalleeCleanupParam = false;
+ for (const auto *P : CD->parameters())
+ if (P->needsDestruction(Context))
+ HasCalleeCleanupParam = true;
+ if (HasCalleeCleanupParam)
+ continue;
+ }
+ }
+ }
+ }
----------------
chinmaydd wrote:
Gentle ping @efriedma-quic @Fznamznon
https://github.com/llvm/llvm-project/pull/182706
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits