blob: fa3293ce79b57fdd3a0893abbf8bc9912220e242 [file] [log] [blame]
Steve Naroffc70e8d92009-07-16 00:25:06 +00001// RUN: clang-cc -fsyntax-only -verify %s
2
Daniel Dunbarf7a0b6b2009-08-17 18:01:54 +00003// Failing currently due to Obj-C type representation changes. 2009-09-17
Daniel Dunbard7390212009-11-03 07:25:45 +00004// XFAIL: *
Daniel Dunbarf7a0b6b2009-08-17 18:01:54 +00005
Steve Naroffc70e8d92009-07-16 00:25:06 +00006typedef struct objc_object {
7 struct objc_class *isa;
8} *id;
9
Steve Narofff242b1b2009-07-24 17:54:45 +000010@interface NSObject {
11 struct objc_class *isa;
12}
13@end
14@interface Whatever : NSObject
Steve Naroffc70e8d92009-07-16 00:25:06 +000015+self;
16@end
17
18static void func() {
19
20 id x;
21
Steve Narofff242b1b2009-07-24 17:54:45 +000022 [(*x).isa self];
23 [x->isa self];
24
25 Whatever *y;
26
27 // GCC allows this, with the following warning:
28 // instance variable ‘isa’ is @protected; this will be a hard error in the future
29 //
30 // FIXME: see if we can avoid the 2 warnings that follow the error.
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')}}
34 [y->isa self]; // expected-error {{instance variable 'isa' is protected}} \
35 expected-warning{{receiver type 'struct objc_class *' is not 'id' or interface pointer, consider casting it to 'id'}} \
36 expected-warning{{method '-self' not found (return type defaults to 'id')}}
Steve Naroffc70e8d92009-07-16 00:25:06 +000037}