mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-23 05:25:50 -04:00

This is not quite NFC: we don't perform the usual arithmetic conversions unless we have an operand of arithmetic or enumeration type any more. This matches the standard rule, but actually has no effect other than to marginally improve our diagnostics for the non-arithmetic, non-enumeration cases (by not performing integral promotions on one operand if the other is a pointer). llvm-svn: 322024
18 lines
785 B
C
18 lines
785 B
C
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
|
|
|
void test() {
|
|
void *vp;
|
|
int *ip;
|
|
char *cp;
|
|
struct foo *fp;
|
|
struct bar *bp;
|
|
short sint = 7;
|
|
|
|
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')}}
|
|
if (sint < ip) {} // expected-warning {{comparison between pointer and integer ('short' and 'int *')}}
|
|
if (ip == cp) {} // expected-warning {{comparison of distinct pointer types ('int *' and 'char *')}}
|
|
}
|