minix/external/bsd/llvm/dist/clang/test/SemaObjCXX/cstyle-cast.mm
Lionel Sambuc f4a2713ac8 Importing netbsd clang -- pristine
Change-Id: Ia40e9ffdf29b5dab2f122f673ff6802a58bc690f
2014-07-28 17:05:57 +02:00

40 lines
537 B
Text

// 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;
}