[llvm] llvm: Disable copy for SingleThreadExecutor (PR #168782)

via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 19 13:51:59 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-support

Author: Fabrice de Gans (Steelskin)

<details>
<summary>Changes</summary>

This is a workaround for the MSVC compiler, which attempts to generate a copy assignment operator implementation for classes marked as `__declspec(dllexport)`. Explicitly marking the copy assignment operator as deleted works around the problem.

DevCom ticket: https://developercommunity.microsoft.com/t/Classes-marked-with-__declspecdllexport/11003192

---
Full diff: https://github.com/llvm/llvm-project/pull/168782.diff


1 Files Affected:

- (modified) llvm/include/llvm/Support/ThreadPool.h (+7) 


``````````diff
diff --git a/llvm/include/llvm/Support/ThreadPool.h b/llvm/include/llvm/Support/ThreadPool.h
index 1be7779f2c72c..933d3f43812ad 100644
--- a/llvm/include/llvm/Support/ThreadPool.h
+++ b/llvm/include/llvm/Support/ThreadPool.h
@@ -225,6 +225,13 @@ class LLVM_ABI SingleThreadExecutor : public ThreadPoolInterface {
   /// Blocking destructor: the pool will first execute the pending tasks.
   ~SingleThreadExecutor() override;
 
+  // Excplicitly disable copy. This is necessary for the MSVC LLVM_DYLIB build
+  // to work around a compiler bug where classes marked as
+  // `__declspec(dllexport)` cause the compiler to attempt to generate a copy
+  // assignment operator.
+  SingleThreadExecutor(const SingleThreadExecutor &) = delete;
+  SingleThreadExecutor &operator=(const SingleThreadExecutor &) = delete;
+
   /// Blocking wait for all the tasks to execute first
   void wait() override;
 

``````````

</details>


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


More information about the llvm-commits mailing list