Debian Codegraph @

gcc/testsuite/gdc.test/runnable/test19251.d

raw
1 string result;
2
3 struct A
4 {
5 int[] a;
6 immutable(A) fun()
7 {
8 result ~= "Yo";
9 return immutable A([7]);
10 }
11
12 alias fun this;
13 }
14
15 void main()
16 {
17 A a;
18 immutable A b = a; // error: cannot implicitly convert expression a of type A to immutable(A)
19 assert(result == "Yo");
20 }