Debian Codegraph @

gcc/testsuite/gdc.test/fail_compilation/test15704.d

raw
1 /*
2 * TEST_OUTPUT:
3 ---
4 fail_compilation/test15704.d(17): Error: copying `void[]` to `void[]` is not allowed in a `@safe` function
5 fail_compilation/test15704.d(18): Error: copying `const(void)[]` to `void[]` is not allowed in a `@safe` function
6 fail_compilation/test15704.d(19): Deprecation: copying `int[]` to `void[]` will become `@system` in a future release
7 ---
8 */
9
10 // https://issues.dlang.org/show_bug.cgi?id=15704
11
12 void main() @safe {
13 Object[] objs = [ new Object() ];
14 void[] arr1 = objs;
15 void[] arr2 = [ 123, 345, 567 ];
16
17 arr1[] = arr2[]; // overwrites pointers with arbitrary ints
18 arr1[] = new const(void)[3];
19 arr1[] = [5];
20 }