Debian Codegraph @

gcc/testsuite/gdc.test/compilable/bug21196.d

raw
1 /*
2 REQUIRED_ARGS: -de
3 */
4
5 // This test can be removed once the deprecation period is over
6 deprecated void appendSlices ( Types ... ) ( ref void[][] slices, ref Types x )
7 {
8 foreach (i, T; Types)
9 {
10 static if (is(T Element: Element[]))
11 {
12 static if (is(T == Element[]))
13 {
14 slices ~= (cast(void*)(&x[i]))[0 .. size_t.sizeof];
15 }
16 // Append a slice to the array content.
17 slices ~= x[i];
18 }
19 else
20 {
21 slices ~= (cast(void*)(&x[i]))[0 .. x[i].sizeof];
22 }
23 }
24 }
25
26 deprecated void myTest()
27 {
28 void[][] slices;
29 char[] str = "Hello World!".dup;
30 appendSlices(slices, str);
31 }