d: Merge upstream dmd, druntime 4c18eed967, phobos d945686a4.
[official-gcc.git] / gcc / testsuite / gdc.test / fail_compilation / fail13775.d
blob8649d591b696927623bfc98f0b43f82639253de6
1 // REQUIRED_ARGS: -o-
2 /*
3 TEST_OUTPUT:
4 ---
5 fail_compilation/fail13775.d(17): Error: cannot cast expression `ubytes[0..2]` of type `ubyte[2]` to `ubyte[1]`
6 fail_compilation/fail13775.d(18): Error: cannot cast expression `ubytes[0..2]` of type `ubyte[2]` to `ubyte[3]`
7 fail_compilation/fail13775.d(19): Error: cannot cast expression `ubytes[0..2]` of type `ubyte[2]` to `byte[1]`
8 fail_compilation/fail13775.d(20): Error: cannot cast expression `ubytes[0..2]` of type `ubyte[2]` to `byte[3]`
9 ---
12 void main()
14 ubyte[4] ubytes = [1,2,3,4];
16 // CT-known slicing succeeds but sizes cannot match
17 auto ng1 = cast(ubyte[1]) ubytes[0 .. 2]; // ubyte[2] to ubyte[1]
18 auto ng2 = cast(ubyte[3]) ubytes[0 .. 2]; // ubyte[2] to ubyte[3]
19 auto ng3 = cast( byte[1]) ubytes[0 .. 2]; // ubyte[2] to byte[1]
20 auto ng4 = cast( byte[3]) ubytes[0 .. 2]; // ubyte[2] to byte[3]