[clang] [clang][Sema] Deprecate `global`/`unknown` in `lifetime_capture_by` (PR #196635)
Gábor Horváth via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 8 11:46:35 PDT 2026
================
@@ -16,12 +16,13 @@ void nonMember(
const int &x2 [[clang::lifetime_capture_by(12345 + 12)]], // expected-error {{'lifetime_capture_by' attribute argument '12345 + 12' is not a known function parameter; must be a function parameter, 'this', 'global' or 'unknown'}}
const int &x3 [[clang::lifetime_capture_by(abcdefgh)]], // expected-error {{'lifetime_capture_by' attribute argument 'abcdefgh' is not a known function parameter; must be a function parameter, 'this', 'global' or 'unknown'}}
const int &x4 [[clang::lifetime_capture_by("abcdefgh")]], // expected-error {{'lifetime_capture_by' attribute argument '"abcdefgh"' is not a known function parameter; must be a function parameter, 'this', 'global' or 'unknown'}}
- const int &x5 [[clang::lifetime_capture_by(this)]], // expected-error {{'lifetime_capture_by' argument references unavailable implicit 'this'}}
+ const int &x5 [[clang::lifetime_capture_by_this]], // expected-error {{'lifetime_capture_by_this' attribute requires an implicit object parameter}}
----------------
Xazax-hun wrote:
Do we have a test for the original error? I think we can emit both of them now.
https://github.com/llvm/llvm-project/pull/196635
More information about the cfe-commits
mailing list