[clang] [clang][Sema] Deprecate `global`/`unknown` in `lifetime_capture_by` (PR #196635)

via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 10 04:09:19 PDT 2026


NeKon69 wrote:

> > I guess we should add an explicit way to suppress these warnings, to handle cases where it's a third-party dependency whose code you don't control.
> 
> I am not sure if we actually need to do anything here. Your suggested migration path looks good to me, but alternatively one could also do:
> 
> ```
> #define MY_ANNOTATION \
>     _Pragma("clang diagnostic push")                                             \
>   _Pragma("clang diagnostic ignore  \"-Wdeprecated_capture_by_special_entity \"") \
>   ABSL_INTERNAL_ATTRIBUTE_CAPTURED_BY_THIS \
>   _Pragma("clang diagnostic pop") 
> ```
> 
> or something similar.

Oh, didn't know about this, TIL.

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


More information about the cfe-commits mailing list