[clang] [clang] Output an error when [[lifetimebound]] attribute is applied on a function parameter while the function returns void (PR #113460)
Boaz Brickner via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 23 08:22:12 PDT 2024
================
@@ -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>()) {
----------------
bricknerb wrote:
I believe we don't.
I've checked and the return type is TemplateTypeParm so it is not considered to be void.
https://github.com/llvm/llvm-project/pull/113460
More information about the cfe-commits
mailing list