[llvm] [sancov] Drop inner braces in `createOrDie` initializer (PR #194836)
Kian Cross via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 29 04:24:38 PDT 2026
https://github.com/kiancross created https://github.com/llvm/llvm-project/pull/194836
The inner braces in `{{ClIgnorelist}}` ask the compiler to construct `std::string` from `cl::opt<std::string>`, which inherits from `std::string`. One candidate is libc++'s explicit basic_string template constructor.
Pre-Clang-20 silently skipped that constructor in this context, so the call compiled. Clang 20's CWG2137 fix now selects it, making `{{ClIgnorelist}}` ill-formed on libc++, e.g., building LLVM on macOS with Xcode 26.
Dropping the inner braces uses `cl::opt`'s implicit conversion to `const std::string&` and compiles cleanly.
>From b4b1a7f450113027fed49862f65be2a4b4e67c59 Mon Sep 17 00:00:00 2001
From: Kian Cross <kian.cross at cl.cam.ac.uk>
Date: Wed, 29 Apr 2026 12:21:48 +0100
Subject: [PATCH] [sancov] Drop inner braces in createOrDie initializer
The inner braces in {{ClIgnorelist}} ask the compiler to construct
std::string from cl::opt<std::string>, which inherits from std::string.
One candidate is libc++'s explicit basic_string template constructor.
Pre-Clang-20 silently skipped that constructor in this context, so
the call compiled. Clang 20's CWG2137 fix now selects it, making
{{ClIgnorelist}} ill-formed on libc++, e.g., building LLVM on
macOS with Xcode 26.
Dropping the inner braces uses cl::opt's implicit conversion to
const std::string& and compiles cleanly.
---
llvm/tools/sancov/sancov.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/tools/sancov/sancov.cpp b/llvm/tools/sancov/sancov.cpp
index d8135e6a2927d..22ab0601eedd2 100644
--- a/llvm/tools/sancov/sancov.cpp
+++ b/llvm/tools/sancov/sancov.cpp
@@ -542,7 +542,7 @@ class Ignorelists {
static std::unique_ptr<SpecialCaseList> createUserIgnorelist() {
if (ClIgnorelist.empty())
return std::unique_ptr<SpecialCaseList>();
- return SpecialCaseList::createOrDie({{ClIgnorelist}},
+ return SpecialCaseList::createOrDie({ClIgnorelist},
*vfs::getRealFileSystem());
}
std::unique_ptr<SpecialCaseList> DefaultIgnorelist;
More information about the llvm-commits
mailing list