xref: /llvm-project/clang/test/SemaObjC/self-declared-in-block.m (revision 0f1c1be1968076d6f96f8a7bcc4a15cf195ecd97)
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
5@interface Blocky @end
6
7@implementation Blocky {
8    int _a;
9}
10- (int)doAThing {
11    ^{
12        char self;
13        return _a;
14    }();
15    return _a;
16}
17
18@end
19
20@interface ShadowSelf
21{
22    int _anIvar;
23}
24@end
25
26@interface C {
27  int _cIvar;
28}
29@end
30
31@implementation ShadowSelf
32- (void)doSomething {
33    __typeof(self) newSelf = self;
34    {
35        __typeof(self) self = newSelf;
36        (void)_anIvar;
37    }
38    {
39      C* self;
40      (void) _anIvar;
41    }
42}
43- (void)doAThing {
44    ^{
45        id self;
46	(void)_anIvar;
47    }();
48}
49@end
50
51