Debian Codegraph @

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

raw
1 /*
2 RUN_OUTPUT:
3 ---
4 this
5 ~this 1
6 ---
7 */
8 // https://issues.dlang.org/show_bug.cgi?id=21586
9
10 import core.stdc.stdio : printf;
11
12 struct S
13 {
14 this(int arg)
15 {
16 a = arg;
17 printf("this\n");
18 }
19
20 ~this()
21 {
22 printf("~this %d\n", a);
23 }
24
25 int a;
26 }
27
28 void main()
29 {
30 auto s = true ? S(1) : S(0);
31 }