| 1 | // RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-darwin10 -fblocks -verify -Wno-objc-root-class %s |
| 2 | // RUN: %clang_cc1 -x objective-c++ -fsyntax-only -triple x86_64-apple-darwin10 -fblocks -verify -Wno-objc-root-class %s |
| 3 | // expected-no-diagnostics |
| 4 | // rdar://9154582 |
| 5 | |
| 6 | @interface Blocky @end |
| 7 | |
| 8 | @implementation Blocky { |
| 9 | int _a; |
| 10 | } |
| 11 | - (int)doAThing { |
| 12 | ^{ |
| 13 | char self; |
| 14 | return _a; |
| 15 | }(); |
| 16 | return _a; |
| 17 | } |
| 18 | |
| 19 | @end |
| 20 | |
| 21 | |
| 22 | // rdar://9284603 |
| 23 | @interface ShadowSelf |
| 24 | { |
| 25 | int _anIvar; |
| 26 | } |
| 27 | @end |
| 28 | |
| 29 | @interface C { |
| 30 | int _cIvar; |
| 31 | } |
| 32 | @end |
| 33 | |
| 34 | @implementation ShadowSelf |
| 35 | - (void)doSomething { |
| 36 | __typeof(self) newSelf = self; |
| 37 | { |
| 38 | __typeof(self) self = newSelf; |
| 39 | (void)_anIvar; |
| 40 | } |
| 41 | { |
| 42 | C* self; |
| 43 | (void) _anIvar; |
| 44 | } |
| 45 | } |
| 46 | - (void)doAThing { |
| 47 | ^{ |
| 48 | id self; |
| 49 | (void)_anIvar; |
| 50 | }(); |
| 51 | } |
| 52 | @end |
| 53 | |
| 54 | |