summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.test/fail_compilation/test15672.d
blob: 19b5bf1c2d172ea073a6eab990ab8ed4a5d8d4d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
 * TEST_OUTPUT:
---
fail_compilation/test15672.d(15): Error: cast from void[] to byte[] not allowed in safe code
fail_compilation/test15672.d(25): Error: cast from void* to byte* not allowed in safe code
---
*/
// https://issues.dlang.org/show_bug.cgi?id=15672

alias byte T;
alias const(byte) CT;

@safe T[] test1(void[] a)
{
    return cast(T[])a;
}

@safe CT[] test2(void[] a)
{
    return cast(CT[])a;
}

@safe T* test3(void* a)
{
    return cast(T*)a;
}

@safe CT* test4(void* a)
{
    return cast(CT*)a;
}

@safe T[] test5()
{
    return cast(T[])[];
}