blob: 3724d0e142fda1bfe25ea4be32eabe98cc12fb6f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
//DIAGNOSTIC_TEST:SIMPLE:
int doSomething(int a)
{
// Warning can't fit
int c0 = 0x800000000;
// No warning as top bits are just ignored
int c1 = -1ll;
int c2 = int(-1u);
// Should sign extend
int c3 = 0x80000000;
// Should give a warning (ideally including the preceeding -)
// Currently we don't have the -, because the lexer lexes - independently
int c4 = -0xfffffffff;
//
a += c0 + c1 + c2;
int64_t b = 0;
// Ok
b += 0x800000000ll;
uint64_t c5 = -2ull;
return a + int(b);
}
|