xref: /minix3/external/bsd/llvm/dist/clang/test/SemaObjC/opaque-is-access.m (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc// RUN: %clang -target x86_64-apple-darwin -arch arm64 -mios-version-min=7 -fsyntax-only %s -Xclang -verify
2*0a6a1f1dSLionel Sambuc// RUN: %clang -target x86_64-apple-darwin -arch x86_64 -mios-simulator-version-min=7 -fsyntax-only %s -Xclang -verify
3*0a6a1f1dSLionel Sambuc// rdar://10709102
4*0a6a1f1dSLionel Sambuc
5*0a6a1f1dSLionel Sambuctypedef struct objc_object {
6*0a6a1f1dSLionel Sambuc  struct objc_class *isa;
7*0a6a1f1dSLionel Sambuc} *id;
8*0a6a1f1dSLionel Sambuc
9*0a6a1f1dSLionel Sambuc@interface NSObject {
10*0a6a1f1dSLionel Sambuc  struct objc_class *isa;
11*0a6a1f1dSLionel Sambuc}
12*0a6a1f1dSLionel Sambuc@end
13*0a6a1f1dSLionel Sambuc@interface Whatever : NSObject
14*0a6a1f1dSLionel Sambuc+self;
15*0a6a1f1dSLionel Sambuc@end
16*0a6a1f1dSLionel Sambuc
17*0a6a1f1dSLionel Sambucstatic void func() {
18*0a6a1f1dSLionel Sambuc
19*0a6a1f1dSLionel Sambuc  id x;
20*0a6a1f1dSLionel Sambuc
21*0a6a1f1dSLionel Sambuc  [(*x).isa self]; // expected-error {{direct access to Objective-C's isa is deprecated in favor of object_getClass()}}
22*0a6a1f1dSLionel Sambuc  [x->isa self];   // expected-error {{direct access to Objective-C's isa is deprecated in favor of object_getClass()}}
23*0a6a1f1dSLionel Sambuc}
24