[clang-tools-extra] [clang-doc][nfc] Avoid combining constexpr with std::initializer_list as this seems to give MSVC trouble. (PR #199311)
Wolfgang Pieb via cfe-commits
cfe-commits at lists.llvm.org
Fri May 22 19:21:44 PDT 2026
https://github.com/wolfy1961 created https://github.com/llvm/llvm-project/pull/199311
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.
>From 90d2bc8c71e69c65ce4e041b55dc3e7e266b9ade Mon Sep 17 00:00:00 2001
From: wpieb <Wolfgang.Pieb at sony.com>
Date: Fri, 22 May 2026 19:14:15 -0700
Subject: [PATCH] Avoid combining constexpr with std::initializer_list as this
seems give MSVC trouble.
---
clang-tools-extra/clang-doc/BitcodeWriter.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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
More information about the cfe-commits
mailing list