blob: c736ed4a167c24ff856eaa43d7bc567e416fbcfb [file] [log] [blame]
John McCall1e5bc4f2012-03-08 22:00:17 +00001// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -fblocks -verify %s
2
3// rdar://problem/10982793
4// [p foo] in ARC creates a cleanup.
5// The plus is invalid and causes the cleanup to go unbound.
6// Don't crash.
7@interface A
8- (id) foo;
9@end
10void takeBlock(void (^)(void));
11void test0(id p) {
12 takeBlock(^{ [p foo] + p; }); // expected-error {{invalid operands to binary expression}}
13}
John McCall100c6492012-03-30 05:23:48 +000014
15void test1(void) {
16 __autoreleasing id p; // expected-note {{'p' declared here}}
17 takeBlock(^{ (void) p; }); // expected-error {{cannot capture __autoreleasing variable in a block}}
18}