blob: 30589d01326faae9f1bff2fc2f968ae7c478d446 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Steve Naroffe77fd3c2007-08-16 21:48:38 +00002
Daniel Dunbar527e5422009-07-23 05:06:51 +00003void test() {
Steve Naroffe77fd3c2007-08-16 21:48:38 +00004 void *vp;
5 int *ip;
6 char *cp;
7 struct foo *fp;
8 struct bar *bp;
9 short sint = 7;
10
Anders Carlsson2d85f8b2007-10-10 20:50:11 +000011 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 Naroffe77fd3c2007-08-16 21:48:38 +000017}