xref: /minix3/external/bsd/llvm/dist/clang/test/SemaObjCXX/pointer-to-objc-pointer-conv.mm (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only -verify %s
2*f4a2713aSLionel Sambuc// expected-no-diagnostics
3*f4a2713aSLionel Sambuc
4*f4a2713aSLionel Sambuc// REQUIRES: LP64
5*f4a2713aSLionel Sambuc
6*f4a2713aSLionel Sambuc@interface G
7*f4a2713aSLionel Sambuc@end
8*f4a2713aSLionel Sambuc
9*f4a2713aSLionel Sambuc@interface F
10*f4a2713aSLionel Sambuc- (void)bar:(id *)objects;
11*f4a2713aSLionel Sambuc- (void)foo:(G**)objects;
12*f4a2713aSLionel Sambuc@end
13*f4a2713aSLionel Sambuc
14*f4a2713aSLionel Sambuc
15*f4a2713aSLionel Sambucvoid a() {
16*f4a2713aSLionel Sambuc	F *b;
17*f4a2713aSLionel Sambuc	G **keys;
18*f4a2713aSLionel Sambuc	[b bar:keys];
19*f4a2713aSLionel Sambuc
20*f4a2713aSLionel Sambuc	id *PID;
21*f4a2713aSLionel Sambuc	[b foo:PID];
22*f4a2713aSLionel Sambuc
23*f4a2713aSLionel Sambuc}
24*f4a2713aSLionel Sambuc
25*f4a2713aSLionel Sambuc
26*f4a2713aSLionel Sambuc// pr7936
27*f4a2713aSLionel Sambuc@interface I1 @end
28*f4a2713aSLionel Sambuc
29*f4a2713aSLionel Sambucclass Wrapper {
30*f4a2713aSLionel Sambucpublic:
31*f4a2713aSLionel Sambuc  operator id() const { return (id)_value; }
32*f4a2713aSLionel Sambuc  operator Class() const { return (Class)_value; }
33*f4a2713aSLionel Sambuc  operator I1*() const { return (I1*)_value; }
34*f4a2713aSLionel Sambuc
35*f4a2713aSLionel Sambuc  bool Compare(id obj) { return *this == obj; }
36*f4a2713aSLionel Sambuc  bool CompareClass(Class obj) { return *this == obj; }
37*f4a2713aSLionel Sambuc  bool CompareI1(I1* obj) { return *this == obj; }
38*f4a2713aSLionel Sambuc
39*f4a2713aSLionel Sambuc  Wrapper &operator*();
40*f4a2713aSLionel Sambuc  Wrapper &operator[](int);
41*f4a2713aSLionel Sambuc  Wrapper& operator->*(int);
42*f4a2713aSLionel Sambuc
43*f4a2713aSLionel Sambucprivate:
44*f4a2713aSLionel Sambuc  long _value;
45*f4a2713aSLionel Sambuc};
46*f4a2713aSLionel Sambuc
47*f4a2713aSLionel Sambucvoid f() {
48*f4a2713aSLionel Sambuc  Wrapper w;
49*f4a2713aSLionel Sambuc  w[0];
50*f4a2713aSLionel Sambuc  *w;
51*f4a2713aSLionel Sambuc  w->*(0);
52*f4a2713aSLionel Sambuc}
53