18fbe78f6SDaniel Dunbar// RUN: %clang_cc1 -fsyntax-only -verify %s
2de1ec9cdSDaniel Dunbar
3de1ec9cdSDaniel Dunbar@interface A
4de1ec9cdSDaniel Dunbar@end
5de1ec9cdSDaniel Dunbar@interface B
6de1ec9cdSDaniel Dunbar@end
7de1ec9cdSDaniel Dunbar
8de1ec9cdSDaniel Dunbarvoid f0(int cond, A *a, B *b) {
9de1ec9cdSDaniel Dunbar  // Ensure that we can still send a message to result of incompatible
10de1ec9cdSDaniel Dunbar  // conditional expression.
111b821b4fSMike Stump  [ (cond ? a : b) test ]; // expected-warning{{incompatible operand types ('A *' and 'B *')}} expected-warning {{method '-test' not found}}
12344e74a9SSteve Naroff}
13344e74a9SSteve Naroff
14344e74a9SSteve Naroff@interface NSKey @end
15344e74a9SSteve Naroff@interface KeySub : NSKey @end
16344e74a9SSteve Naroff
17344e74a9SSteve Naroff@interface UpdatesList @end
18344e74a9SSteve Naroff
19344e74a9SSteve Naroffvoid foo (int i, NSKey *NSKeyValueCoding_NullValue, UpdatesList *nukedUpdatesList)
20344e74a9SSteve Naroff{
21344e74a9SSteve Naroff  id obj;
22344e74a9SSteve Naroff  NSKey *key;
23344e74a9SSteve Naroff  KeySub *keysub;
24344e74a9SSteve Naroff
251b821b4fSMike Stump  obj = i ? NSKeyValueCoding_NullValue : nukedUpdatesList; // expected-warning{{incompatible operand types ('NSKey *' and 'UpdatesList *')}}
261b821b4fSMike Stump  key = i ? NSKeyValueCoding_NullValue : nukedUpdatesList; // expected-warning{{incompatible operand types ('NSKey *' and 'UpdatesList *')}}
27344e74a9SSteve Naroff  key = i ? NSKeyValueCoding_NullValue : keysub;
28*c68e1406SDouglas Gregor  keysub = i ? NSKeyValueCoding_NullValue : keysub; // expected-warning{{incompatible pointer types assigning to 'KeySub *' from 'NSKey *'}}
29de1ec9cdSDaniel Dunbar}
30