Don't crash when a statement in a block is ill-formed but
introduces cleanups anyway. llvm-svn: 152345
This commit is contained in:
parent
812924502b
commit
85110b47c8
|
@ -8892,6 +8892,8 @@ ExprResult Sema::ActOnBlockStmtExpr(SourceLocation CaretLoc,
|
|||
Diag(CaretLoc, diag::err_blocks_disable);
|
||||
|
||||
// Leave the expression-evaluation context.
|
||||
if (hasAnyUnrecoverableErrorsInThisFunction())
|
||||
DiscardCleanupsInEvaluationContext();
|
||||
assert(!ExprNeedsCleanups && "cleanups within block not correctly bound!");
|
||||
PopExpressionEvaluationContext();
|
||||
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -fblocks -verify %s
|
||||
|
||||
// rdar://problem/10982793
|
||||
// [p foo] in ARC creates a cleanup.
|
||||
// The plus is invalid and causes the cleanup to go unbound.
|
||||
// Don't crash.
|
||||
@interface A
|
||||
- (id) foo;
|
||||
@end
|
||||
void takeBlock(void (^)(void));
|
||||
void test0(id p) {
|
||||
takeBlock(^{ [p foo] + p; }); // expected-error {{invalid operands to binary expression}}
|
||||
}
|
Loading…
Reference in New Issue