[clang] [clang] Output an error when [[lifetimebound]] attribute is applied on a function implicit object parameter while the function returns void (PR #114203)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 5 06:12:21 PST 2024


================
@@ -6967,6 +6967,11 @@ static void checkAttributesAfterMerging(Sema &S, NamedDecl &ND) {
         } else if (isa<CXXConstructorDecl>(MD) || isa<CXXDestructorDecl>(MD)) {
           S.Diag(A->getLocation(), diag::err_lifetimebound_ctor_dtor)
               << isa<CXXDestructorDecl>(MD) << A->getRange();
+        } else if (FD->getReturnType()->isVoidType()) {
----------------
usx95 wrote:

nit: use `MD` instead of `FD` since we are working on a method decl (although both are correct).

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


More information about the cfe-commits mailing list