| 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 |
--- |
| 10 |
*/ |
| 11 |
|
| 12 |
void main() |
| 13 |
{ |
| 14 |
ubyte[4] ubytes = [1,2,3,4]; |
| 15 |
|
| 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] |
| 21 |
} |