[cfe-commits] r76108 - /cfe/trunk/test/SemaObjC/conditional-expr.m

Daniel Dunbar daniel at zuster.org
Thu Jul 16 14:56:02 PDT 2009


Author: ddunbar
Date: Thu Jul 16 16:55:48 2009
New Revision: 76108

URL: http://llvm.org/viewvc/llvm-project?rev=76108&view=rev
Log:
Add more testing of ?: for Obj-C object types.

Modified:
    cfe/trunk/test/SemaObjC/conditional-expr.m

Modified: cfe/trunk/test/SemaObjC/conditional-expr.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/conditional-expr.m?rev=76108&r1=76107&r2=76108&view=diff

==============================================================================
--- cfe/trunk/test/SemaObjC/conditional-expr.m (original)
+++ cfe/trunk/test/SemaObjC/conditional-expr.m Thu Jul 16 16:55:48 2009
@@ -42,3 +42,53 @@
   return nextOutputStream ? nextOutputStream : self;
 }
 @end
+
+//
+
+ at protocol P0
+ at property int intProp;
+ at end
+ at protocol P1
+ at end
+ at protocol P2
+ at end
+
+ at interface A <P0>
+ at end
+
+ at interface B : A
+ at end
+
+ at interface C
+ at end
+
+ at interface D
+ at end
+
+void f0(id<P0> x) {
+  x.intProp = 1;
+}
+
+void f1(int cond, id<P0> x, id<P0> y) {
+  (cond ? x : y).intProp = 1;
+}
+
+void f2(int cond, id<P0> x, A *y) {
+  (cond ? x : y).intProp = 1;
+}
+
+void f3(int cond, id<P0> x, B *y) {
+  (cond ? x : y).intProp = 1;
+}
+
+void f4(int cond, id x, B *y) {
+  (cond ? x : y).intProp = 1; // expected-error {{property 'intProp' not found on object of type 'id'}}
+}
+
+void f5(int cond, id<P0> x, C *y) {
+  (cond ? x : y).intProp = 1; // expected-error {{property 'intProp' not found on object of type 'C *'}}
+}
+
+void f6(int cond, C *x, D *y) {
+  (cond ? x : y).intProp = 1; // expected-warning {{incompatible operand types}}, expected-error {{property 'intProp' not found on object of type 'id'}}
+}





More information about the cfe-commits mailing list