From: Daniel Dunbar Date: Thu, 16 Jul 2009 23:34:22 +0000 (+0000) Subject: Some more ?: for Obj-C tests. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8cbd38c9d1ed04793b8084a63f74edbdb9051934;p=clang Some more ?: for Obj-C tests. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76125 91177308-0d34-0410-b5e6-96231b3b80d8 --- 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 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 x, A* p) { + return a ? x : p; +} + +void f8(int a, A *x, A *y) { + [ (a ? x : y ) intProp ]; +} + +void f9(int a, A *x, A *y) { + id l0 = (a ? x : y ); // expected-warning {{incompatible operand types ('A *' and 'A *')'}} + A *l1 = (a ? x : y ); // expected-warning {{incompatible operand types ('A *' and 'A *')}} + A *l2 = (a ? x : y ); // expected-warning {{incompatible operand types ('A *' and 'A *')}} + [ (a ? x : y ) intProp ]; // expected-warning {{incompatible operand types ('A *' and 'A *')}} +} + +void f10(int a, id x, id y) { + [ (a ? x : y ) intProp ]; +} + +void f11(int a, id x, id y) { + [ (a ? x : y ) intProp ]; // expected-warning {{incompatible operand types ('id' and 'id')}} +} + +void f12(int a, A *x, A *y) { + A* l0 = (a ? x : y ); // expected-warning {{incompatible operand types ('A *' and 'A *')}} +}