blob: dbb6b2f53d86e9ab34fd159f3a469dd3a1fff30a [file] [log] [blame]
Steve Naroffc70e8d92009-07-16 00:25:06 +00001// RUN: clang-cc -fsyntax-only -verify %s
2
3typedef struct objc_object {
4 struct objc_class *isa;
5} *id;
6
Steve Narofff242b1b2009-07-24 17:54:45 +00007@interface NSObject {
8 struct objc_class *isa;
9}
10@end
11@interface Whatever : NSObject
Steve Naroffc70e8d92009-07-16 00:25:06 +000012+self;
13@end
14
15static void func() {
16
17 id x;
18
Steve Narofff242b1b2009-07-24 17:54:45 +000019 [(*x).isa self];
20 [x->isa self];
21
22 Whatever *y;
23
24 // GCC allows this, with the following warning:
25 // instance variable ‘isa’ is @protected; this will be a hard error in the future
26 //
27 // FIXME: see if we can avoid the 2 warnings that follow the error.
28 [(*y).isa self]; // expected-error {{instance variable 'isa' is protected}} \
29 expected-warning{{receiver type 'struct objc_class *' is not 'id' or interface pointer, consider casting it to 'id'}} \
30 expected-warning{{method '-self' not found (return type defaults to 'id')}}
31 [y->isa self]; // expected-error {{instance variable 'isa' is protected}} \
32 expected-warning{{receiver type 'struct objc_class *' is not 'id' or interface pointer, consider casting it to 'id'}} \
33 expected-warning{{method '-self' not found (return type defaults to 'id')}}
Steve Naroffc70e8d92009-07-16 00:25:06 +000034}