[clang] [LifetimeSafety] Avoid suggesting lifetimebound attribute on primary templates declarations (PR #203866)

via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 15 07:50:37 PDT 2026


NeKon69 wrote:

> Do we still warn on the primary template here:
> 
> ```
> template <typename T>
> T &foo(T &obj) { return obj; }
> 
> // later: f(x); where x is int.
> ```
> 
> ?

I believe so. There's a test for that in: https://github.com/llvm/llvm-project/blob/e26e9ba06f46f9619bb6d2df40850a54559640ce/clang/test/Sema/LifetimeSafety/annotation-suggestions.cpp#L401-L409

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


More information about the cfe-commits mailing list