Debian Codegraph @

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

raw
1 // PERMUTE_ARGS:
2
3 // COMDAT folding increases runtime by > 80x
4 // REQUIRED_ARGS(windows): -L/OPT:NOICF
5
6 // Generate \sum_{i=0}^{14} 2^i = 32767 template instantiations
7 // (each with 3 sections) to use more than 64Ki sections in total.
8
9 size_t foo(size_t i, size_t mask)()
10 {
11 static if (i == 14)
12 return mask;
13 else
14 return foo!(i + 1, mask) + foo!(i + 1, mask | (1UL << i));
15 }
16
17 void main()
18 {
19 assert(foo!(0, 0) != 0);
20 }