mirror of
https://github.com/dlang/dmd.git
synced 2025-04-28 06:00:13 +03:00
Fix endian issue when printing hex string literals
This commit is contained in:
parent
2a7a9c459a
commit
55dcc3dc82
3 changed files with 5 additions and 4 deletions
|
@ -2281,7 +2281,8 @@ private void expressionPrettyPrint(Expression e, ref OutBuffer buf, ref HdrGenSt
|
|||
{
|
||||
buf.writeByte('x');
|
||||
buf.writeByte('"');
|
||||
buf.writeHexString(e.peekData, true);
|
||||
foreach (i; 0 .. e.len)
|
||||
buf.printf("%0*llX", e.sz, e.getIndex(i));
|
||||
buf.writeByte('"');
|
||||
if (e.postfix)
|
||||
buf.writeByte(e.postfix);
|
||||
|
|
|
@ -12,8 +12,8 @@ fail_compilation/hexstring.d(38): Error: array cast from `string` to `immutable(
|
|||
fail_compilation/hexstring.d(39): Error: array cast from `string` to `immutable(uint[])` is not supported at compile time
|
||||
fail_compilation/hexstring.d(39): perhaps remove postfix `c` from hex string
|
||||
fail_compilation/hexstring.d(40): Error: hex string with `dstring` type needs to be multiple of 4 bytes, not 5
|
||||
fail_compilation/hexstring.d(41): Error: cannot implicitly convert expression `x"44332211"d` of type `dstring` to `immutable(float[])`
|
||||
fail_compilation/hexstring.d(42): Error: cannot implicitly convert expression `x"2211"w` of type `wstring` to `immutable(ubyte[])`
|
||||
fail_compilation/hexstring.d(41): Error: cannot implicitly convert expression `x"11223344"d` of type `dstring` to `immutable(float[])`
|
||||
fail_compilation/hexstring.d(42): Error: cannot implicitly convert expression `x"1122"w` of type `wstring` to `immutable(ubyte[])`
|
||||
fail_compilation/hexstring.d(28): Error: cannot implicitly convert expression `x"123F"` of type `string` to `ubyte[]`
|
||||
---
|
||||
*/
|
||||
|
|
|
@ -263,7 +263,7 @@ void testHexstring()
|
|||
|
||||
// Test printing StringExp with size 8
|
||||
enum toStr(immutable ulong[] v) = v.stringof;
|
||||
static assert(toStr!y == `x"88776655443322119900FFEEDDCCBBAA"`);
|
||||
static assert(toStr!y == `x"1122334455667788AABBCCDDEEFF0099"`);
|
||||
|
||||
// Hex string postfixes
|
||||
// https://issues.dlang.org/show_bug.cgi?id=24363
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue