summaryrefslogtreecommitdiff
path: root/clang/test/SemaObjCXX/cstyle-cast.mm
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/SemaObjCXX/cstyle-cast.mm')
-rw-r--r--clang/test/SemaObjCXX/cstyle-cast.mm40
1 files changed, 40 insertions, 0 deletions
diff --git a/clang/test/SemaObjCXX/cstyle-cast.mm b/clang/test/SemaObjCXX/cstyle-cast.mm
new file mode 100644
index 0000000..29a8404
--- /dev/null
+++ b/clang/test/SemaObjCXX/cstyle-cast.mm
@@ -0,0 +1,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;
+
+}
+