diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-07-16 23:34:22 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-07-16 23:34:22 +0000 |
commit | 8cbd38c9d1ed04793b8084a63f74edbdb9051934 (patch) | |
tree | 79ea320be87f48ec1eaa8dba1e2487ed931bd667 | |
parent | bcbb8bd3326a86aa70b7df386ae3c86c9ad255c5 (diff) |
Some more ?: for Obj-C tests.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76125 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/SemaObjC/conditional-expr.m | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/SemaObjC/conditional-expr.m b/test/SemaObjC/conditional-expr.m index e7855163f1..8ae1338277 100644 --- a/test/SemaObjC/conditional-expr.m +++ b/test/SemaObjC/conditional-expr.m @@ -92,3 +92,30 @@ void f5(int cond, id<P0> x, C *y) { 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'}} } + +id f7(int a, id<P0> x, A* p) { + return a ? x : p; +} + +void f8(int a, A<P0> *x, A *y) { + [ (a ? x : y ) intProp ]; +} + +void f9(int a, A<P0> *x, A<P1> *y) { + id l0 = (a ? x : y ); // expected-warning {{incompatible operand types ('A<P0> *' and 'A<P1> *')'}} + A<P0> *l1 = (a ? x : y ); // expected-warning {{incompatible operand types ('A<P0> *' and 'A<P1> *')}} + A<P1> *l2 = (a ? x : y ); // expected-warning {{incompatible operand types ('A<P0> *' and 'A<P1> *')}} + [ (a ? x : y ) intProp ]; // expected-warning {{incompatible operand types ('A<P0> *' and 'A<P1> *')}} +} + +void f10(int a, id<P0> x, id y) { + [ (a ? x : y ) intProp ]; +} + +void f11(int a, id<P0> x, id<P1> y) { + [ (a ? x : y ) intProp ]; // expected-warning {{incompatible operand types ('id<P0>' and 'id<P1>')}} +} + +void f12(int a, A<P0> *x, A<P1> *y) { + A<P1>* l0 = (a ? x : y ); // expected-warning {{incompatible operand types ('A<P0> *' and 'A<P1> *')}} +} |