d: Merge dmd. druntime e770945277, phobos 6d6e0b9b9
[official-gcc.git] / gcc / testsuite / gdc.test / fail_compilation / hexstring.d
blobcaca3b3e97e7afdf2a7415907a061e486313c234
1 /**
2 TEST_OUTPUT:
3 ---
4 fail_compilation/hexstring.d(29): Error: cannot implicitly convert expression `"123F"` of type `string` to `immutable(ubyte[])`
5 fail_compilation/hexstring.d(30): Error: cannot implicitly convert expression `x"123F"c` of type `string` to `immutable(ubyte[])`
6 fail_compilation/hexstring.d(31): Error: cannot implicitly convert expression `x"123F"` of type `string` to `immutable(ubyte[])`
7 fail_compilation/hexstring.d(33): Error: hex string length 1 must be a multiple of 2 to cast to `immutable(ushort[])`
8 fail_compilation/hexstring.d(34): Error: hex string length 3 must be a multiple of 4 to cast to `immutable(uint[])`
9 fail_compilation/hexstring.d(35): Error: hex string length 5 must be a multiple of 8 to cast to `immutable(ulong[])`
10 fail_compilation/hexstring.d(36): Error: array cast from `wstring` to `immutable(ulong[])` is not supported at compile time
11 fail_compilation/hexstring.d(36): perhaps remove postfix `w` from hex string
12 fail_compilation/hexstring.d(37): Error: array cast from `string` to `immutable(uint[])` is not supported at compile time
13 fail_compilation/hexstring.d(38): Error: array cast from `string` to `immutable(ushort[])` is not supported at compile time
14 fail_compilation/hexstring.d(39): Error: array cast from `string` to `immutable(uint[])` is not supported at compile time
15 fail_compilation/hexstring.d(39): perhaps remove postfix `c` from hex string
16 fail_compilation/hexstring.d(28): Error: cannot implicitly convert expression `x"123F"` of type `string` to `ubyte[]`
17 ---
20 immutable ubyte[] s0 = x"123F";
21 static assert(s0[0] == 0x12);
22 static assert(s0[1] == 0x3F);
23 immutable byte[] s1 = x"123F";
25 enum E(X) = cast(X[]) x"AABBCCDD";
26 static assert(E!int[0] == 0xAABBCCDD);
28 ubyte[] f1 = x"123F";
29 immutable ubyte[] f2 = "123F";
30 immutable ubyte[] f3 = x"123F"c;
31 immutable ubyte[] f4 = cast(string) x"123F";
33 immutable ushort[] f5 = cast(immutable ushort[]) x"11";
34 immutable uint[] f6 = cast(immutable uint[]) x"112233";
35 immutable ulong[] f7 = cast(immutable ulong[]) x"1122334455";
36 immutable ulong[] f8 = cast(immutable ulong[]) x"1122334455"w;
37 immutable uint[] f9 = cast(immutable uint[]) "ABCD";
38 immutable ushort[] f10 = cast(immutable ushort[]) (x"1122" ~ "");
39 immutable uint[] f11 = cast(immutable uint[]) x"AABBCCDD"c;