]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gdc.test/fail_compilation/test15672.d
Add D front-end, libphobos library, and D2 testsuite.
[thirdparty/gcc.git] / gcc / testsuite / gdc.test / fail_compilation / test15672.d
1 /*
2 * TEST_OUTPUT:
3 ---
4 fail_compilation/test15672.d(15): Error: cast from void[] to byte[] not allowed in safe code
5 fail_compilation/test15672.d(25): Error: cast from void* to byte* not allowed in safe code
6 ---
7 */
8 // https://issues.dlang.org/show_bug.cgi?id=15672
9
10 alias byte T;
11 alias const(byte) CT;
12
13 @safe T[] test1(void[] a)
14 {
15 return cast(T[])a;
16 }
17
18 @safe CT[] test2(void[] a)
19 {
20 return cast(CT[])a;
21 }
22
23 @safe T* test3(void* a)
24 {
25 return cast(T*)a;
26 }
27
28 @safe CT* test4(void* a)
29 {
30 return cast(CT*)a;
31 }
32
33 @safe T[] test5()
34 {
35 return cast(T[])[];
36 }
37
38