Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Steve Naroff | e77fd3c | 2007-08-16 21:48:38 +0000 | [diff] [blame] | 2 | |
Daniel Dunbar | 527e542 | 2009-07-23 05:06:51 +0000 | [diff] [blame] | 3 | void test() { |
Steve Naroff | e77fd3c | 2007-08-16 21:48:38 +0000 | [diff] [blame] | 4 | void *vp; |
| 5 | int *ip; |
| 6 | char *cp; |
| 7 | struct foo *fp; |
| 8 | struct bar *bp; |
| 9 | short sint = 7; |
| 10 | |
Anders Carlsson | 2d85f8b | 2007-10-10 20:50:11 +0000 | [diff] [blame] | 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 *')}} |
Steve Naroff | e77fd3c | 2007-08-16 21:48:38 +0000 | [diff] [blame] | 17 | } |