blob: 824acd8cfe9c02ffd24a966cf2dc26fd37fe143f (
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
33
34
35
36
37
38
39
40
41
42
43
44
|
/* bug-3462.c
Behaviour on enumeration constants outside the range of (unsigned) long didn't make sense.
*/
#include <testfwk.h>
#ifdef __SDCC
enum e0
{
E0_0,
E0_1
};
enum e1
{
E1_0 = 0xff,
E1_1
};
enum e2
{
E2_0 = 0xffff,
E2_1
};
enum e3
{
E3_0 = 0xffffffff,
E3_1
};
#endif
void
testBug (void)
{
// The choice of the underlying type is implementation-defined.
#ifdef __SDCC
ASSERT (sizeof(enum e0) == 1);
ASSERT (sizeof(enum e1) == 2);
ASSERT (sizeof(enum e2) == 4);
ASSERT (sizeof(enum e3) == 8);
#endif
}
|