Skip to content

[libc] Add template deduction guide for cpp::lock_guard. #91589

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 9, 2024
Merged

Conversation

lntue
Copy link
Contributor

@lntue lntue commented May 9, 2024

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

@lntue lntue requested a review from SchrodingerZhu May 9, 2024 13:22
@llvmbot llvmbot added the libc label May 9, 2024
@llvmbot
Copy link
Member

llvmbot commented May 9, 2024

@llvm/pr-subscribers-libc

Author: None (lntue)

Changes

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 --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
 

@lntue lntue merged commit 6f1013a into llvm:main May 9, 2024
@lntue lntue deleted the ctad branch May 9, 2024 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants