blob: 16a36fc58b303859d9ebfdb078e0c5fda2ce123d [file] [log] [blame]
Douglas Gregord6fb7ef2008-12-18 19:37:40 +00001// RUN: clang -fsyntax-only -verify %s
Douglas Gregordda78892008-12-18 23:43:31 +00002@interface Foo
3@end
4
5@implementation Foo
6
7void func(id);
8
9+ zone {
10 func(self);
11 return self;
12}
13
Douglas Gregor7ca09762008-11-27 01:19:21 +000014@protocol P0
15@end
16
17@protocol P1
18@end
19
20@interface A <P0>
Douglas Gregorcb7de522008-11-26 23:31:11 +000021@end
22
23@interface B : A
24@end
25
Douglas Gregor7ca09762008-11-27 01:19:21 +000026@interface C <P1>
27@end
28
Douglas Gregorcb7de522008-11-26 23:31:11 +000029int& f(A*);
30float& f(B*);
31void g(A*);
32
33int& h(A*);
34float& h(id);
35
36void test(A* a, B* b, id val) {
37 int& i1 = f(a);
38 float& f1 = f(b);
39 float& f2 = f(val);
40 g(a);
41 g(b);
42 g(val);
43 int& i2 = h(a);
44 float& f3 = h(val);
45 // int& i3 = h(b); FIXME: we match GCC here, but shouldn't this work?
46}
47
48int& cv(A*);
49float& cv(const A*);
50int& cv2(void*);
51float& cv2(const void*);
52
53void cv_test(A* a, B* b, const A* ac, const B* bc) {
54 int &i1 = cv(a);
55 int &i2 = cv(b);
56 float &f1 = cv(ac);
57 float &f2 = cv(bc);
58 int& i3 = cv2(a);
59 float& f3 = cv2(ac);
60}
Douglas Gregor7ca09762008-11-27 01:19:21 +000061
62
63int& qualid(id<P0>);
64float& qualid(id<P1>); // FIXME: GCC complains that this isn't an overload. Is it?
65
66void qualid_test(A *a, B *b, C *c) {
67 int& i1 = qualid(a);
68 int& i2 = qualid(b);
69 float& f1 = qualid(c);
70}