[libcxx-commits] [libcxx] [libc++] Avoid relying on CTAD for std::lock_guard in the benchmarks (PR #225503)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Sep 22 12:46:43 PDT 2026
https://github.com/ldionne created https://github.com/llvm/llvm-project/pull/225503
libc++ provides a deduction guide for std::lock_guard, but libstdc++ does not, so the code trips -Wctad-maybe-unsupported when the benchmark is built against libstdc++.
>From 28e959d5150b21e2ba982bb21f1814a5144c4806 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Tue, 22 Sep 2026 12:31:15 -0700
Subject: [PATCH] [libc++] Avoid relying on CTAD for std::lock_guard in the
benchmarks
libc++ provides a deduction guide for std::lock_guard, but libstdc++
does not, so the code trips -Wctad-maybe-unsupported when the benchmark
is built against libstdc++.
---
libcxx/test/benchmarks/stringstream.bench.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libcxx/test/benchmarks/stringstream.bench.cpp b/libcxx/test/benchmarks/stringstream.bench.cpp
index 052696815236d4..123727a3b49886 100644
--- a/libcxx/test/benchmarks/stringstream.bench.cpp
+++ b/libcxx/test/benchmarks/stringstream.bench.cpp
@@ -39,7 +39,7 @@ struct LocaleSelector {
static std::mutex mutex;
LocaleSelector(benchmark::State& state) {
- std::lock_guard guard(mutex);
+ std::lock_guard<std::mutex> guard(mutex);
switch (state.range(0)) {
case 0: {
old = std::locale::global(std::locale::classic());
@@ -67,7 +67,7 @@ struct LocaleSelector {
}
~LocaleSelector() {
- std::lock_guard guard(mutex);
+ std::lock_guard<std::mutex> guard(mutex);
std::locale::global(old);
}
};
More information about the libcxx-commits
mailing list