| 1 |
// RUN: %clang_cc1 -fsyntax-only -verify %s |
| 2 |
|
| 3 |
@protocol P @end |
| 4 |
@interface I @end |
| 5 |
|
| 6 |
struct X { X(); }; |
| 7 |
|
| 8 |
void test1(X x) { |
| 9 |
void *cft; |
| 10 |
id oct = (id)cft; |
| 11 |
|
| 12 |
Class ccct; |
| 13 |
ccct = (Class)cft; |
| 14 |
|
| 15 |
I* iict = (I*)cft; |
| 16 |
|
| 17 |
id<P> qid = (id<P>)cft; |
| 18 |
|
| 19 |
I<P> *ip = (I<P>*)cft; |
| 20 |
|
| 21 |
(id)x; // expected-error {{cannot convert 'X' to 'id' without a conversion operator}} |
| 22 |
|
| 23 |
id *pid = (id*)ccct; |
| 24 |
|
| 25 |
id<P> *qpid = (id<P>*)ccct; |
| 26 |
|
| 27 |
int **pii; |
| 28 |
|
| 29 |
ccct = (Class)pii; |
| 30 |
|
| 31 |
qpid = (id<P>*)pii; |
| 32 |
|
| 33 |
iict = (I*)pii; |
| 34 |
|
| 35 |
pii = (int **)ccct; |
| 36 |
|
| 37 |
pii = (int **)qpid; |
| 38 |
|
| 39 |
} |
| 40 |
|