[clang-tools-extra] [clang-doc][nfc] Avoid combining constexpr with std::initializer_list as this seems to give MSVC trouble. (PR #199311)
via cfe-commits
cfe-commits at lists.llvm.org
Fri May 22 19:22:18 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-tools-extra
Author: Wolfgang Pieb (wolfy1961)
<details>
<summary>Changes</summary>
Some Windows bots using MSVC 2019 and 2022 get assertion errors in the clang-doc lit tests (see [here](https://github.com/llvm/llvm-project/pull/198066). This seems to be due to MSVC having trouble with a correctly initializing structures using std::initializer_list when embedded in a struct declared with constexpr.
This workaround changes constexpr to const in a struct definition to avoid this issue.
---
Full diff: https://github.com/llvm/llvm-project/pull/199311.diff
1 Files Affected:
- (modified) clang-tools-extra/clang-doc/BitcodeWriter.cpp (+1-1)
``````````diff
diff --git a/clang-tools-extra/clang-doc/BitcodeWriter.cpp b/clang-tools-extra/clang-doc/BitcodeWriter.cpp
index f8431a44ec533..2ab1bbf4a8a16 100644
--- a/clang-tools-extra/clang-doc/BitcodeWriter.cpp
+++ b/clang-tools-extra/clang-doc/BitcodeWriter.cpp
@@ -252,7 +252,7 @@ struct BlockToIdList {
std::initializer_list<RecordId> RIDs;
};
-static constexpr BlockToIdList RecordsByBlock[] = {
+static const BlockToIdList RecordsByBlock[] = {
// Version Block
{BI_VERSION_BLOCK_ID, {VERSION}},
// Comment Block
``````````
</details>
https://github.com/llvm/llvm-project/pull/199311
More information about the cfe-commits
mailing list