diff options
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/Parser/if-scope-c90.c | 2 | ||||
-rw-r--r-- | clang/test/Parser/if-scope-c99.c | 2 | ||||
-rw-r--r-- | clang/test/Sema/compare.c | 8 |
3 files changed, 10 insertions, 2 deletions
diff --git a/clang/test/Parser/if-scope-c90.c b/clang/test/Parser/if-scope-c90.c index fdc75e9f10b..53987dccbc3 100644 --- a/clang/test/Parser/if-scope-c90.c +++ b/clang/test/Parser/if-scope-c90.c @@ -2,7 +2,7 @@ int f (int z) { - if (z > sizeof (enum {a, b})) + if (z > (int) sizeof (enum {a, b})) return a; return b; } diff --git a/clang/test/Parser/if-scope-c99.c b/clang/test/Parser/if-scope-c99.c index 37cd0e15ab8..b4cb51ca8c4 100644 --- a/clang/test/Parser/if-scope-c99.c +++ b/clang/test/Parser/if-scope-c99.c @@ -2,7 +2,7 @@ int f (int z) { - if (z > sizeof (enum {a, b})) + if (z > (int) sizeof (enum {a, b})) return a; return b; // expected-error{{use of undeclared identifier}} } diff --git a/clang/test/Sema/compare.c b/clang/test/Sema/compare.c index 87131bb6218..50b40e459c3 100644 --- a/clang/test/Sema/compare.c +++ b/clang/test/Sema/compare.c @@ -7,6 +7,14 @@ int test(char *C) { // nothing here should warn. return C != 1; // expected-warning {{comparison between pointer and integer ('char *' and 'int')}} } +int ints(long a, unsigned long b) { + return (a == b) + // expected-warning {{comparison of integers of different signs}} + ((int)a == b) + // expected-warning {{comparison of integers of different signs}} + ((short)a == b) + // expected-warning {{comparison of integers of different signs}} + (a == (unsigned int) b) + // expected-warning {{comparison of integers of different signs}} + (a == (unsigned short) b); // expected-warning {{comparison of integers of different signs}} +} + int equal(char *a, const char *b) { return a == b; } |