Debian Codegraph @

gcc/testsuite/gdc.test/fail_compilation/fail21547.d

raw
1 // https://issues.dlang.org/show_bug.cgi?id=21547
2
3 /*
4 TEST_OUTPUT:
5 ---
6 fail_compilation/fail21547.d(32): Error: struct `Bar` has constructors, cannot use `{ initializers }`, use `Bar( initializers )` instead
7 fail_compilation/fail21547.d(33): Error: struct `Bar1` has constructors, cannot use `{ initializers }`, use `Bar1( initializers )` instead
8 ---
9 */
10
11 struct Bar
12 {
13 @disable this(int a) {}
14 this(int a, int b) {}
15
16 string a;
17 uint b;
18 }
19
20 struct Bar1
21 {
22 @disable this(int a) {}
23 this(const ref Bar1 o) {}
24 this(int a, int b) {}
25
26 string a;
27 uint b;
28 }
29
30 void main ()
31 {
32 Bar b = { a: "Hello", b: 42 };
33 Bar1 b1 = { a: "Hello", b: 42 };
34 }