blob: 806b078e8df6c99559ae5ccbbfa789dcbee7ea3a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
// RUN: clang-cc -fsyntax-only -pedantic -verify %s
int test0(long a, unsigned long b) {
enum Enum {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}}
// Should be able to prove all of these are non-negative.
return (b == (long) B) +
(b == (int) B) +
(b == (short) B);
}
|