[clang] [LifetimeSafety] Warn on meaningless [[clang::lifetimebound]] parameters (PR #201101)

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 2 05:30:57 PDT 2026


================
@@ -11034,6 +11034,11 @@ def warn_lifetime_safety_cross_tu_misplaced_lifetimebound
       InGroup<LifetimeSafetyCrossTUMisplacedLifetimebound>,
       DefaultIgnore;
 
+def warn_lifetime_safety_meaningless_lifetimebound
+    : Warning<"'lifetimebound' attribute has no effect on parameter of type %0">,
----------------
Xazax-hun wrote:

Oh, I guess the current logic would never trigger in this case. But here is one example:

```
struct [[gsl::owner]] S {};

struct R {
  S method() [[clang::lifetimebound]];
};
```

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


More information about the cfe-commits mailing list