1 // https://issues.dlang.org/show_bug.cgi?id=20998
3 REQUIRED_ARGS: -verrors=context
6 fail_compilation/test20998.d(76): Error: undefined identifier `invalid`
7 X x = { invalid, 2, "asd" };
9 fail_compilation/test20998.d(76): Error: too many initializers for `X` with 2 fields
10 X x = { invalid, 2, "asd" };
12 fail_compilation/test20998.d(83): Error: cannot implicitly convert expression `"a"` of type `string` to `int`
13 X2 x2 = { ptr: null, "a", ptr: 2, 444 };
15 fail_compilation/test20998.d(83): Error: duplicate initializer for field `ptr`
16 X2 x2 = { ptr: null, "a", ptr: 2, 444 };
18 fail_compilation/test20998.d(83): Error: too many initializers for `X2` with 3 fields
19 X2 x2 = { ptr: null, "a", ptr: 2, 444 };
21 fail_compilation/test20998.d(90): Error: overlapping initialization for field `ptr` and `x`
22 X3 x3 = { ptr: null, "a", ptr: 2, 444 };
24 fail_compilation/test20998.d(90): Error: cannot implicitly convert expression `"a"` of type `string` to `int`
25 X3 x3 = { ptr: null, "a", ptr: 2, 444 };
27 fail_compilation/test20998.d(90): Error: duplicate initializer for field `ptr`
28 X3 x3 = { ptr: null, "a", ptr: 2, 444 };
30 fail_compilation/test20998.d(90): Error: too many initializers for `X3` with 3 fields
31 X3 x3 = { ptr: null, "a", ptr: 2, 444 };
33 fail_compilation/test20998.d(98): Error: field `X4.ptr` cannot assign to misaligned pointers in `@safe` code
34 X4 x4 = { ptr: null, "a", 444, ptr: 2, true };
36 fail_compilation/test20998.d(98): Error: cannot implicitly convert expression `"a"` of type `string` to `int`
37 X4 x4 = { ptr: null, "a", 444, ptr: 2, true };
39 fail_compilation/test20998.d(98): Error: too many initializers for `X4` with 2 fields
40 X4 x4 = { ptr: null, "a", 444, ptr: 2, true };
42 fail_compilation/test20998.d(102): called from here: `test()`
45 fail_compilation/test20998.d(104): Error: cannot implicitly convert expression `1` of type `int` to `void*`
46 X2 a5 = { ptr: 1, ptr: 2, ptr: 444, ptr: 555 };
48 fail_compilation/test20998.d(104): Error: duplicate initializer for field `ptr`
49 X2 a5 = { ptr: 1, ptr: 2, ptr: 444, ptr: 555 };
51 fail_compilation/test20998.d(104): Error: duplicate initializer for field `ptr`
52 X2 a5 = { ptr: 1, ptr: 2, ptr: 444, ptr: 555 };
54 fail_compilation/test20998.d(104): Error: too many initializers for `X2` with 3 fields
55 X2 a5 = { ptr: 1, ptr: 2, ptr: 444, ptr: 555 };
57 fail_compilation/test20998.d(107): Error: too many initializers for `X2` with 3 fields
58 X2 c6 = { null, 2, true, null };
60 fail_compilation/test20998.d(116): Error: cannot implicitly convert expression `1` of type `int` to `immutable(char*)`
61 immutable Struct iStruct = {1, &ch};
63 fail_compilation/test20998.d(116): Error: too many initializers for `Struct` with 1 field
64 immutable Struct iStruct = {1, &ch};
66 fail_compilation/test20998.d(120): called from here: `test2()`
76 X x
= { invalid
, 2, "asd" };
83 X2 x2
= { ptr
: null, "a", ptr
: 2, 444 };
90 X3 x3
= { ptr
: null, "a", ptr
: 2, 444 };
98 X4 x4
= { ptr
: null, "a", 444, ptr
: 2, true };
104 X2 a5
= { ptr
: 1, ptr
: 2, ptr
: 444, ptr
: 555 };
105 X2 b5
= { ptr
: null, y
: true };
106 X2 c5
= { x
: 2, true, ptr
: null };
107 X2 c6
= { null, 2, true, null };
116 immutable Struct iStruct
= {1, &ch
};