• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// RUN: cp %s %t
2// RUN: %clang_cc1 -x objective-c -fixit %t
3// RUN: %clang_cc1 -x objective-c -Werror %t
4// rdar://13503456
5
6void object_setClass(id, id);
7Class object_getClass(id);
8
9id rhs();
10
11Class pr6302(id x123) {
12  x123->isa  = 0;
13  x123->isa = rhs();
14  x123->isa = (id)(x123->isa);
15  x123->isa = (id)x123->isa;
16  x123->isa = (x123->isa);
17  x123->isa = (id)(x123->isa);
18  return x123->isa;
19}
20
21
22@interface BaseClass {
23@public
24    Class isa; // expected-note 3 {{instance variable is declared here}}
25}
26@end
27
28@interface OtherClass {
29@public
30    id    firstIvar;
31    Class isa; // note, not first ivar;
32}
33@end
34
35@interface Subclass : BaseClass @end
36
37@interface SiblingClass : BaseClass @end
38
39@interface Root @end
40
41@interface hasIsa : Root {
42@public
43  Class isa; // note, isa is not in root class
44}
45@end
46
47@implementation Subclass
48-(void)method {
49    hasIsa *u;
50    id v;
51    BaseClass *w;
52    Subclass *x;
53    SiblingClass *y;
54    OtherClass *z;
55    (void)v->isa;
56    (void)w->isa;
57    (void)x->isa;
58    (void)y->isa;
59    (void)z->isa;
60    (void)u->isa;
61    y->isa = 0;
62    y->isa = w->isa;
63    x->isa = rhs();
64}
65@end
66
67