Daniel Dunbar | d7d5f02 | 2009-03-24 02:24:46 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -fsyntax-only -verify %s |
Daniel Dunbar | a56f746 | 2008-08-26 00:41:39 +0000 | [diff] [blame] | 2 | |
| 3 | @interface A |
| 4 | @end |
| 5 | @interface B |
| 6 | @end |
| 7 | |
| 8 | void f0(int cond, A *a, B *b) { |
| 9 | // Ensure that we can still send a message to result of incompatible |
| 10 | // conditional expression. |
Steve Naroff | 1fd0361 | 2009-02-12 19:05:07 +0000 | [diff] [blame] | 11 | [ (cond ? a : b) test ]; // expected-warning{{comparison of distinct pointer types ('A *' and 'B *')}} expected-warning {{method '-test' not found}} |
| 12 | } |
| 13 | |
| 14 | @interface NSKey @end |
| 15 | @interface KeySub : NSKey @end |
| 16 | |
| 17 | @interface UpdatesList @end |
| 18 | |
| 19 | void foo (int i, NSKey *NSKeyValueCoding_NullValue, UpdatesList *nukedUpdatesList) |
| 20 | { |
| 21 | id obj; |
| 22 | NSKey *key; |
| 23 | KeySub *keysub; |
| 24 | |
| 25 | obj = i ? NSKeyValueCoding_NullValue : nukedUpdatesList; // expected-warning{{comparison of distinct pointer types ('NSKey *' and 'UpdatesList *')}} |
| 26 | key = i ? NSKeyValueCoding_NullValue : nukedUpdatesList; // expected-warning{{comparison of distinct pointer types ('NSKey *' and 'UpdatesList *')}} |
| 27 | key = i ? NSKeyValueCoding_NullValue : keysub; |
| 28 | keysub = i ? NSKeyValueCoding_NullValue : keysub; // expected-warning{{incompatible pointer types assigning 'NSKey *', expected 'KeySub *'}} |
Daniel Dunbar | a56f746 | 2008-08-26 00:41:39 +0000 | [diff] [blame] | 29 | } |