[clang] [clang] Improve the lifetime_capture_by diagnostic on the constructor. (PR #117792)

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 28 01:16:04 PST 2024


================
@@ -411,3 +411,22 @@ void use() {
 }
 } // namespace with_span
 } // namespace inferred_capture_by
+
+namespace on_constructor {
+struct T {
+  T(const int& t [[clang::lifetime_capture_by(this)]]);
+};
+struct T2 {
+  T2(const int& t [[clang::lifetime_capture_by(x)]], int& x);
+};
+int foo(const T& t);
----------------
hokein wrote:

Done.

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


More information about the cfe-commits mailing list