Skip to content

Conversation

@Steelskin
Copy link
Contributor

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

@llvmbot
Copy link
Member

llvmbot commented Nov 19, 2025

@llvm/pr-subscribers-llvm-support

Author: Fabrice de Gans (Steelskin)

Changes

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 --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;
 

@github-actions
Copy link

github-actions bot commented Nov 19, 2025

🐧 Linux x64 Test Results

  • 186451 tests passed
  • 4868 tests skipped

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.
@Steelskin Steelskin force-pushed the fabrice/workaround-msvc-disable-copy-assignment branch from 2fbb148 to 84a01ba Compare November 21, 2025 15:53
@compnerd compnerd merged commit f8a8039 into llvm:main Nov 21, 2025
10 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 21, 2025

LLVM Buildbot has detected a new failure on builder lld-x86_64-ubuntu-fast running on as-builder-4 while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/33/builds/26924

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: tools/llvm-exegesis/RISCV/rvv/filter.test' FAILED ********************
Exit Code: 2

Command Output (stdout):
--
# RUN: at line 1
/home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/build/bin/llvm-exegesis -mtriple=riscv64 -mcpu=sifive-x280 -benchmark-phase=assemble-measured-code --mode=inverse_throughput --opcode-name=PseudoVNCLIPU_WX_M1_MASK     --riscv-filter-config='vtype = {VXRM: rod, AVL: VLMAX, SEW: e(8|16), Policy: ta/mu}' --max-configs-per-opcode=1000 --min-instructions=10 | /home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/build/bin/FileCheck /home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/llvm-project/llvm/test/tools/llvm-exegesis/RISCV/rvv/filter.test
# executed command: /home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/build/bin/llvm-exegesis -mtriple=riscv64 -mcpu=sifive-x280 -benchmark-phase=assemble-measured-code --mode=inverse_throughput --opcode-name=PseudoVNCLIPU_WX_M1_MASK '--riscv-filter-config=vtype = {VXRM: rod, AVL: VLMAX, SEW: e(8|16), Policy: ta/mu}' --max-configs-per-opcode=1000 --min-instructions=10
# .---command stderr------------
# | PseudoVNCLIPU_WX_M1_MASK: Failed to produce any snippet via: instruction has tied variables, avoiding Read-After-Write issue, picking random def and use registers not aliasing each other, for uses, one unique register for each position
# `-----------------------------
# executed command: /home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/build/bin/FileCheck /home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/llvm-project/llvm/test/tools/llvm-exegesis/RISCV/rvv/filter.test
# .---command stderr------------
# | FileCheck error: '<stdin>' is empty.
# | FileCheck command line:  /home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/build/bin/FileCheck /home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/llvm-project/llvm/test/tools/llvm-exegesis/RISCV/rvv/filter.test
# `-----------------------------
# error: command failed with exit status: 2

--

********************


@Steelskin Steelskin deleted the fabrice/workaround-msvc-disable-copy-assignment branch November 21, 2025 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants