diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index e686e83583919..5d09c454dea29 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -674,6 +674,8 @@ Bug Fixes in This Version value exprs is invalid. Propagating the error info up by replacing BlockExpr with a RecoveryExpr. This fixes: (`#63863 _`) +- Invalidate BlockDecl with invalid ParmVarDecl + (`#64005 _`) Bug Fixes to Compiler Builtins ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 3c9d0efca8a1e..716383412cc58 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -16959,6 +16959,9 @@ void Sema::ActOnBlockArguments(SourceLocation CaretLoc, Declarator &ParamInfo, PushOnScopeChains(AI, CurBlock->TheScope); } + + if (AI->isInvalidDecl()) + CurBlock->TheDecl->setInvalidDecl(); } } diff --git a/clang/test/AST/ast-dump-recovery.m b/clang/test/AST/ast-dump-recovery.m index c2bd078959aba..37fa8045c0b94 100644 --- a/clang/test/AST/ast-dump-recovery.m +++ b/clang/test/AST/ast-dump-recovery.m @@ -24,3 +24,9 @@ void k(Foo *foo) { int (^gh63863)() = ^() { return undef; }; + +// CHECK: `-BlockExpr {{.*}} 'int (^)(int, int)' +// CHECK-NEXT: `-BlockDecl {{.*}} invalid +int (^gh64005)(int, int) = ^(int, undefined b) { + return 1; +};