d: Merge upstream dmd 47871363d, druntime, c52e28b7, phobos 99e9c1b77.
[official-gcc.git] / gcc / testsuite / gdc.test / fail_compilation / test15703.d
blobdd07857dbe6d4e957b822e9cb7ffea0b308cb7d0
1 /*
2 REQUIRED_ARGS: -m32
3 TEST_OUTPUT:
4 ---
5 fail_compilation/test15703.d(16): Error: cast from `Object[]` to `uint[]` not allowed in safe code
6 fail_compilation/test15703.d(18): Error: cast from `object.Object` to `const(uint)*` not allowed in safe code
7 fail_compilation/test15703.d(21): Error: cast from `uint[]` to `Object[]` not allowed in safe code
8 ---
9 */
11 // https://issues.dlang.org/show_bug.cgi?id=15703
13 void test() @safe
15 auto objs = [ new Object() ];
16 auto longs = cast(size_t[]) objs; // error
17 auto longc = cast(const(size_t)[]) objs; // ok
18 auto longp = cast(const(size_t)*) objs[0]; // error
20 size_t[] al;
21 objs = cast(Object[]) al; // error
23 auto am = cast(int[])[];
26 void test2() @safe
28 const(ubyte)[] a;
29 auto b = cast(const(uint[])) a;