[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:37 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: None (lntue)

<details>
<summary>Changes</summary>

Fix ctad-maybe-unsupported warnings for `cpp::lock_guard`.

---
Full diff: https://github.com/llvm/llvm-project/pull/91589.diff


1 Files Affected:

- (modified) libc/src/__support/CPP/mutex.h (+3) 


``````````diff
diff --git a/libc/src/__support/CPP/mutex.h b/libc/src/__support/CPP/mutex.h
index 345816fae233..ff9c9f43a43c 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
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/91589


More information about the libc-commits mailing list