Steve Naroff | c70e8d9 | 2009-07-16 00:25:06 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -fsyntax-only -verify %s |
| 2 | |
Daniel Dunbar | f7a0b6b | 2009-08-17 18:01:54 +0000 | [diff] [blame] | 3 | // Failing currently due to Obj-C type representation changes. 2009-09-17 |
Daniel Dunbar | d739021 | 2009-11-03 07:25:45 +0000 | [diff] [blame] | 4 | // XFAIL: * |
Daniel Dunbar | f7a0b6b | 2009-08-17 18:01:54 +0000 | [diff] [blame] | 5 | |
Steve Naroff | c70e8d9 | 2009-07-16 00:25:06 +0000 | [diff] [blame] | 6 | typedef struct objc_object { |
| 7 | struct objc_class *isa; |
| 8 | } *id; |
| 9 | |
Steve Naroff | f242b1b | 2009-07-24 17:54:45 +0000 | [diff] [blame] | 10 | @interface NSObject { |
| 11 | struct objc_class *isa; |
| 12 | } |
| 13 | @end |
| 14 | @interface Whatever : NSObject |
Steve Naroff | c70e8d9 | 2009-07-16 00:25:06 +0000 | [diff] [blame] | 15 | +self; |
| 16 | @end |
| 17 | |
| 18 | static void func() { |
| 19 | |
| 20 | id x; |
| 21 | |
Steve Naroff | f242b1b | 2009-07-24 17:54:45 +0000 | [diff] [blame] | 22 | [(*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 Naroff | c70e8d9 | 2009-07-16 00:25:06 +0000 | [diff] [blame] | 37 | } |