summaryrefslogtreecommitdiff
path: root/clang/test/SemaObjCXX/cstyle-cast.mm
blob: 29a8404660c97746039411e418904a2fbc15ac2b (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// RUN: %clang_cc1 -fsyntax-only -verify %s

@protocol P @end
@interface I @end

struct X { X(); };

void test1(X x) {
  void *cft;
  id oct = (id)cft;

  Class ccct;
  ccct = (Class)cft;

  I* iict = (I*)cft;

  id<P> qid = (id<P>)cft;

  I<P> *ip = (I<P>*)cft;

  (id)x; // expected-error {{cannot convert 'X' to 'id' without a conversion operator}}

  id *pid = (id*)ccct;

  id<P> *qpid = (id<P>*)ccct;

  int **pii;

  ccct = (Class)pii;

  qpid = (id<P>*)pii;

  iict = (I*)pii;

  pii = (int **)ccct;

  pii = (int **)qpid;
  
}