xref: /aosp_15_r20/external/clang/test/Parser/pointer_promotion.c (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 -fsyntax-only -verify %s
2*67e74705SXin Li 
test()3*67e74705SXin Li void test() {
4*67e74705SXin Li   void *vp;
5*67e74705SXin Li   int *ip;
6*67e74705SXin Li   char *cp;
7*67e74705SXin Li   struct foo *fp;
8*67e74705SXin Li   struct bar *bp;
9*67e74705SXin Li   short sint = 7;
10*67e74705SXin Li 
11*67e74705SXin Li   if (ip < cp) {} // expected-warning {{comparison of distinct pointer types ('int *' and 'char *')}}
12*67e74705SXin Li   if (cp < fp) {} // expected-warning {{comparison of distinct pointer types ('char *' and 'struct foo *')}}
13*67e74705SXin Li   if (fp < bp) {} // expected-warning {{comparison of distinct pointer types ('struct foo *' and 'struct bar *')}}
14*67e74705SXin Li   if (ip < 7) {} // expected-warning {{comparison between pointer and integer ('int *' and 'int')}}
15*67e74705SXin Li   if (sint < ip) {} // expected-warning {{comparison between pointer and integer ('int' and 'int *')}}
16*67e74705SXin Li   if (ip == cp) {} // expected-warning {{comparison of distinct pointer types ('int *' and 'char *')}}
17*67e74705SXin Li }
18