[clang] [LifetimeSafety] Warn on inapplicable `[[clang::lifetimebound]]` when return type can not carry a lifetime (PR #203767)

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 20 07:00:55 PDT 2026


================
@@ -560,11 +560,23 @@ class LifetimeChecker {
         FDef->getTemplateSpecializationKind() == TSK_ImplicitInstantiation)
       return;
 
+    QualType ReturnType = FDef->getReturnType();
+    if (const auto *Ctor = dyn_cast<CXXConstructorDecl>(FDef))
----------------
Xazax-hun wrote:

Do we need this special case? As in can we ever trigger a warning for ctors at the moment?

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


More information about the cfe-commits mailing list