```
Without this, stack-use-after-scope can only be detected at runtime with ASan or code review, both of which are expensive.
Use LIFETIMEBOUND to turn this error into a compile warning.
See https://releases.llvm.org/12.0.0/tools/clang/docs/AttributeReference.html#lifetimebound
Example:
const CScript a{WITH_LOCK(::cs_main, return CScript{} << OP_0 << OP_1)};
Before: (no warning)
After:
warning: returning reference to local temporary object [-Wreturn-stack-address]
const CScript a{WITH_LOCK(::cs_main, return CScript{} << OP_0 << OP_1)};
^~~~~~~~~
./sync.h:276:65: note: expanded from macro 'WITH_LOCK'
^~~~
```
Backport of core#22278.