Debian Codegraph @

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

raw
1 // https://issues.dlang.org/show_bug.cgi?id=13435
2
3 /*
4 TEST_OUTPUT:
5 ---
6 fail_compilation/fail13435.d(22): Error: cannot implicitly convert expression `d` of type `int[]` to `S!int`
7 fail_compilation/fail13435.d(22): `this._a = d` is the first assignment of `this._a` therefore it represents its initialization
8 fail_compilation/fail13435.d(22): `opAssign` methods are not used for initialization, but for subsequent assignments
9 ---
10 */
11
12 struct S(T)
13 {
14 void opAssign(T[] arg) {}
15 }
16
17 class B
18 {
19 this(int[] d)
20 {
21 S!int c;
22 _a = d; // Error: cannot implicitly convert expression (d) of type int[] to S!int
23 c = d; // compiles OK
24 }
25
26 S!int _a;
27 }