Debian Codegraph @

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

raw
1 // https://issues.dlang.org/show_bug.cgi?id=23861
2
3 /*
4 TEST_OUTPUT:
5 ---
6 fail_compilation/fail23861.d(24): Error: cannot implicitly convert expression `3` of type `int` to `Foo`
7 ---
8 */
9
10 Foo global;
11
12 struct Foo
13 {
14 ref Foo get()
15 {
16 return global;
17 }
18 alias get this;
19 }
20
21 void main()
22 {
23 Foo g;
24 g = 3;
25 }