Debian Codegraph @

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

raw
1 // https://issues.dlang.org/show_bug.cgi?id=5153
2
3 /*
4 TEST_OUTPUT:
5 ---
6 fail_compilation/fail5153.d(26): Error: cannot implicitly convert expression `new Foo(0)` of type `Foo*` to `Foo`
7 fail_compilation/fail5153.d(26): Perhaps remove the `new` keyword?
8 ---
9 */
10
11 class Foo2
12 {
13 this(int) {}
14 }
15
16 struct Foo {
17 int x;
18 this(int x_)
19 {
20 this.x = x_;
21 }
22
23 this(Foo2) {}
24 }
25 void main() {
26 Foo f = new Foo(0);
27 Foo f2 = new Foo2(0);
28 }