]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gdc.test/fail_compilation/fail109.d
Add D front-end, libphobos library, and D2 testsuite.
[thirdparty/gcc.git] / gcc / testsuite / gdc.test / fail_compilation / fail109.d
1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/fail109.d(12): Error: enum member fail109.Bool.Unknown initialization with `Bool.True+1` causes overflow for type `bool`
5 ---
6 */
7
8 enum Bool : bool
9 {
10 False,
11 True,
12 Unknown
13 }
14
15 /* Bugzilla 11088
16 TEST_OUTPUT:
17 ---
18 fail_compilation/fail109.d(25): Error: enum member fail109.E.B initialization with `E.A+1` causes overflow for type `int`
19 fail_compilation/fail109.d(31): Error: enum member fail109.E1.B initialization with `E1.A+1` causes overflow for type `short`
20 ---
21 */
22 enum E
23 {
24 A = int.max,
25 B
26 }
27
28 enum E1 : short
29 {
30 A = short.max,
31 B
32 }
33
34 /* Bugzilla 14950
35 TEST_OUTPUT:
36 ---
37 fail_compilation/fail109.d(50): Deprecation: Comparison between different enumeration types `B` and `C`; If this behavior is intended consider using `std.conv.asOriginalType`
38 fail_compilation/fail109.d(50): Error: enum member fail109.B.end initialization with `B.start+1` causes overflow for type `C`
39 ---
40 */
41 enum C
42 {
43 start,
44 end
45 }
46
47 enum B
48 {
49 start = C.end,
50 end
51 }
52
53 /* Bugzilla 11849
54 TEST_OUTPUT:
55 ---
56 fail_compilation/fail109.d(72): Error: enum fail109.RegValueType1a recursive definition of `.max` property
57 fail_compilation/fail109.d(79): Error: enum fail109.RegValueType1b recursive definition of `.max` property
58 fail_compilation/fail109.d(84): Error: enum fail109.RegValueType2a recursive definition of `.min` property
59 fail_compilation/fail109.d(91): Error: enum fail109.RegValueType2b recursive definition of `.min` property
60 ---
61 */
62
63 alias DWORD = uint;
64
65 enum : DWORD
66 {
67 REG_DWORD = 4
68 }
69
70 enum RegValueType1a : DWORD
71 {
72 Unknown = DWORD.max,
73 DWORD = REG_DWORD,
74 }
75
76 enum RegValueType1b : DWORD
77 {
78 DWORD = REG_DWORD,
79 Unknown = DWORD.max,
80 }
81
82 enum RegValueType2a : DWORD
83 {
84 Unknown = DWORD.min,
85 DWORD = REG_DWORD,
86 }
87
88 enum RegValueType2b : DWORD
89 {
90 DWORD = REG_DWORD,
91 Unknown = DWORD.min,
92 }