Ted Kremenek | 9f3d942 | 2007-09-26 20:14:22 +0000 | [diff] [blame^] | 1 | // RUN: clang -parse-ast -verify %s |
Steve Naroff | e77fd3c | 2007-08-16 21:48:38 +0000 | [diff] [blame] | 2 | |
| 3 | int test() { |
| 4 | void *vp; |
| 5 | int *ip; |
| 6 | char *cp; |
| 7 | struct foo *fp; |
| 8 | struct bar *bp; |
| 9 | short sint = 7; |
| 10 | |
| 11 | if (ip < cp) ; // expected-warning {{comparison of distinct pointer types ('int *' and 'char *')}} |
| 12 | if (cp < fp) ; // expected-warning {{comparison of distinct pointer types ('char *' and 'struct foo *')}} |
| 13 | if (fp < bp) ; // expected-warning {{comparison of distinct pointer types ('struct foo *' and 'struct bar *')}} |
| 14 | if (ip < 7) ; // expected-warning {{comparison between pointer and integer ('int *' and 'int')}} |
| 15 | if (sint < ip) ; // expected-warning {{comparison between pointer and integer ('int' and 'int *')}} |
| 16 | if (ip == cp) ; // expected-warning {{comparison of distinct pointer types ('int *' and 'char *')}} |
| 17 | } |
| 18 | |