2009-12-16 04:14:24 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
2007-08-17 05:48:38 +08:00
|
|
|
|
2022-02-09 22:10:10 +08:00
|
|
|
void test(void) {
|
2007-08-17 05:48:38 +08:00
|
|
|
void *vp;
|
|
|
|
int *ip;
|
|
|
|
char *cp;
|
|
|
|
struct foo *fp;
|
|
|
|
struct bar *bp;
|
|
|
|
short sint = 7;
|
|
|
|
|
2007-10-11 04:50:11 +08:00
|
|
|
if (ip < cp) {} // expected-warning {{comparison of distinct pointer types ('int *' and 'char *')}}
|
|
|
|
if (cp < fp) {} // expected-warning {{comparison of distinct pointer types ('char *' and 'struct foo *')}}
|
|
|
|
if (fp < bp) {} // expected-warning {{comparison of distinct pointer types ('struct foo *' and 'struct bar *')}}
|
|
|
|
if (ip < 7) {} // expected-warning {{comparison between pointer and integer ('int *' and 'int')}}
|
2018-01-09 05:12:04 +08:00
|
|
|
if (sint < ip) {} // expected-warning {{comparison between pointer and integer ('short' and 'int *')}}
|
2007-10-11 04:50:11 +08:00
|
|
|
if (ip == cp) {} // expected-warning {{comparison of distinct pointer types ('int *' and 'char *')}}
|
2007-08-17 05:48:38 +08:00
|
|
|
}
|