Debian Codegraph @

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

raw
1 // https://issues.dlang.org/show_bug.cgi?id=21120
2
3 module one.two.three;
4
5 struct S {}
6
7 struct StructTemplate(T)
8 {
9 int a = 123; // non-zero initialized
10
11 ref const(StructTemplate) getInitSymbol()
12 {
13 return initSymbol!StructTemplate;
14 }
15 }
16
17 template initSymbol(T)
18 {
19 pragma(mangle, "_D" ~ T.mangleof[1..$] ~ "6__initZ")
20 extern immutable T initSymbol;
21 }
22
23 void main()
24 {
25 StructTemplate!S inst;
26 assert(inst.getInitSymbol() == inst);
27 }