Debian Codegraph @

gcc/testsuite/gdc.dg/torture/pr100882.d

raw
1 // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100882
2 // { dg-additional-options "-fmain" }
3 // { dg-do run }
4
5 __gshared int counter = 0;
6 struct S100882
7 {
8 this(int) { counter++; }
9 ~this() { counter++; }
10 }
11 static S100882 s;
12 static this()
13 {
14 s = cast(shared) S100882(0);
15 assert(counter == 2);
16 }
17
18 auto test100882()
19 {
20 return cast(shared) S100882(0);
21 }