From a3f41f4bbaf080a3b693c8d4a0cfa3f40e8ed42e Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Thu, 16 Jul 2009 23:34:22 +0000 Subject: [PATCH] Some more ?: for Obj-C tests. llvm-svn: 76125 --- clang/test/SemaObjC/conditional-expr.m | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/clang/test/SemaObjC/conditional-expr.m b/clang/test/SemaObjC/conditional-expr.m index e7855163f181..8ae13382772c 100644 --- a/clang/test/SemaObjC/conditional-expr.m +++ b/clang/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 *')}} +}