1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
2 | |
3 | void 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 ('short' and 'int *')}} |
16 | if (ip == cp) {} // expected-warning {{comparison of distinct pointer types ('int *' and 'char *')}} |
17 | } |
18 | |