[libc-commits] [libc] [libc] Add template deduction guide for cpp::lock_guard. (PR #91589)
via libc-commits
libc-commits at lists.llvm.org
Thu May 9 06:22:06 PDT 2024
https://github.com/lntue created https://github.com/llvm/llvm-project/pull/91589
Fix ctad-maybe-unsupported warnings for `cpp::lock_guard`.
>From 53ee829147f98b95a639d15b65db447fa6b23b48 Mon Sep 17 00:00:00 2001
From: Tue Ly <lntue at google.com>
Date: Thu, 9 May 2024 09:20:51 -0400
Subject: [PATCH] [libc] Add template deduction guide for cpp::lock_guard.
---
libc/src/__support/CPP/mutex.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libc/src/__support/CPP/mutex.h b/libc/src/__support/CPP/mutex.h
index 345816fae2336..ff9c9f43a43cc 100644
--- a/libc/src/__support/CPP/mutex.h
+++ b/libc/src/__support/CPP/mutex.h
@@ -40,6 +40,9 @@ template <typename MutexType> class lock_guard {
lock_guard(const lock_guard &) = delete;
};
+// Deduction guide for lock_guard to suppress CTAD warnings.
+template <typename T> lock_guard(T &) -> lock_guard<T>;
+
} // namespace cpp
} // namespace LIBC_NAMESPACE
More information about the libc-commits
mailing list