================ @@ -6970,6 +6970,18 @@ static void checkAttributesAfterMerging(Sema &S, NamedDecl &ND) { } } } + + for (unsigned int I = 0; I < FD->getNumParams(); ++I) { + const ParmVarDecl *P = FD->getParamDecl(I); + + // The [[lifetimebound]] attribute can be applied to a function parameter + // only if the function returns a value. + if (auto *A = P->getAttr<LifetimeBoundAttr>()) { ---------------- usx95 wrote:
An interesting case that [came up](https://github.com/llvm/llvm-project/issues/107556#issuecomment-2333906528) involves dependent return type. I think we should not be showing this error if there is a dependent return type. ```cpp template <class T, class R = void> R foo(const T& t [[clang::lifetimebound]]); foo<int>(1); const int& r = foo<int, int>(1); ``` There is no way to fix this for one instantiation and not for the other so we should be accepting these. Can you also add test involving tempates with and without dependent return types. https://github.com/llvm/llvm-project/pull/113460 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits