[clang] [Clang] Export inline move constructors in dllexport-ed template instantiations on non-MSVC targets (PR #168170)

Ben Dunbobbin via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 26 13:53:59 PST 2025


================
@@ -6627,6 +6627,7 @@ void Sema::checkClassLevelDLLAttribute(CXXRecordDecl *Class) {
         auto *Ctor = dyn_cast<CXXConstructorDecl>(MD);
         if ((MD->isMoveAssignmentOperator() ||
              (Ctor && Ctor->isMoveConstructor())) &&
+            getLangOpts().isCompatibleWithMSVC(LangOptions::MSVC2010) &&
----------------
bd1976bris wrote:

This tripped me up when I first looked at it. I think it would be nice to introduce a  no argument form `bool isCompatibleWithMSVC() const;` and then write the MSVC compatibility bit as: `getLangOpts().isCompatibleWithMSVC() && !getLangOpts().isCompatibleWithMSVC(LangOptions::MSVC2015)`

https://github.com/llvm/llvm-project/pull/168170


More information about the cfe-commits mailing list