John McCall | 1e5bc4f | 2012-03-08 22:00:17 +0000 | [diff] [blame] | 1 | // 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 |
| 10 | void takeBlock(void (^)(void)); |
| 11 | void test0(id p) { |
| 12 | takeBlock(^{ [p foo] + p; }); // expected-error {{invalid operands to binary expression}} |
| 13 | } |
John McCall | 100c649 | 2012-03-30 05:23:48 +0000 | [diff] [blame] | 14 | |
| 15 | void 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 | } |