diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -1992,7 +1992,8 @@ return false; } - if (D->hasAttr() || D->hasAttr()) + if (D->hasAttr() || D->hasAttr() || + D->hasAttr()) return false; if (isa(D)) diff --git a/clang/test/Sema/warn-unused-variables.c b/clang/test/Sema/warn-unused-variables.c --- a/clang/test/Sema/warn-unused-variables.c +++ b/clang/test/Sema/warn-unused-variables.c @@ -30,3 +30,8 @@ (void)(^() { int X = 4; }); // expected-warning{{unused}} (void)(^() { int X = 4; return Y + X; }); // expected-error {{use of undeclared identifier 'Y'}} } + +void c1(int *); +int f4(void) { + int __attribute__((cleanup(c1))) X1 = 4; +}