[llvm] llvm: Disable copy for SingleThreadExecutor (PR #168782)
Fabrice de Gans via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 19 13:51:19 PST 2025
https://github.com/Steelskin created https://github.com/llvm/llvm-project/pull/168782
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
>From 2fbb148827197cbd69c6b0fd0c5c891571255694 Mon Sep 17 00:00:00 2001
From: Fabrice de Gans <fabrice at thebrowser.company>
Date: Wed, 19 Nov 2025 21:48:34 +0000
Subject: [PATCH] llvm: Disable copy for SingleThreadExecutor
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
---
llvm/include/llvm/Support/ThreadPool.h | 7 +++++++
1 file changed, 7 insertions(+)
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;
More information about the llvm-commits
mailing list