MATCH: Improve `A CMP 0 ? A : -A` set of patterns to use bitwise_equal_p.
[official-gcc.git] / gcc / testsuite / gdc.test / fail_compilation / fail9665b.d
blob898054643cf3b91a032fb3622d624d2814b3e6d2
1 /***************************************************/
2 // with disable this() struct
4 struct X
6 @disable this();
8 this(int) {}
12 TEST_OUTPUT:
13 ---
14 fail_compilation/fail9665b.d(32): Error: one path skips field `x2`
15 fail_compilation/fail9665b.d(33): Error: one path skips field `x3`
16 fail_compilation/fail9665b.d(35): Error: one path skips field `x5`
17 fail_compilation/fail9665b.d(36): Error: one path skips field `x6`
18 fail_compilation/fail9665b.d(30): Error: field `x1` must be initialized in constructor
19 fail_compilation/fail9665b.d(30): Error: field `x4` must be initialized in constructor
20 ---
22 struct S1
24 X x1;
25 X x2;
26 X x3;
27 X[2] x4;
28 X[2] x5;
29 X[2] x6;
30 this(int)
32 if (true) x2 = X(1);
33 auto n = true ? (x3 = X(1)) : X.init;
35 if (true) x5 = X(1);
36 auto m = true ? (x6 = X(1)) : typeof(x6).init;
40 /***************************************************/
41 // with nested struct
44 TEST_OUTPUT:
45 ---
46 fail_compilation/fail9665b.d(65): Error: one path skips field `x2`
47 fail_compilation/fail9665b.d(66): Error: one path skips field `x3`
48 fail_compilation/fail9665b.d(68): Error: one path skips field `x5`
49 fail_compilation/fail9665b.d(69): Error: one path skips field `x6`
50 fail_compilation/fail9665b.d(63): Error: field `x1` must be initialized in constructor, because it is nested struct
51 fail_compilation/fail9665b.d(63): Error: field `x4` must be initialized in constructor, because it is nested struct
52 fail_compilation/fail9665b.d(76): Error: template instance `fail9665b.S2!(X)` error instantiating
53 ---
55 struct S2(X)
57 X x1;
58 X x2;
59 X x3;
60 X[2] x4;
61 X[2] x5;
62 X[2] x6;
63 this(X x)
65 if (true) x2 = x;
66 auto a = true ? (x3 = x) : X.init;
68 if (true) x5 = x;
69 auto b = true ? (x6 = x) : typeof(x6).init;
72 void test2()
74 struct X { this(int) {} }
75 static assert(X.tupleof.length == 1);
76 S2!(X) s = X(1);