Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions dstep/translator/MacroDefinition.d
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ string translate(Literal literal, ExpressionContext context)
auto suffix = literal.spelling[integer.length .. $];
auto core = uinteger[0 .. $ - 1].stripLeft('0') ~ uinteger[$ - 1];
return "octal!" ~ core ~ suffix;
} else if (literal.spelling.length >= 3 && literal.spelling[0..2] == "L\"")
{
return literal.spelling[1..$] ~ "w";
}

return literal.spelling;
Expand Down
16 changes: 16 additions & 0 deletions tests/unit/MacroTranslTests.d
Original file line number Diff line number Diff line change
Expand Up @@ -841,3 +841,19 @@ extern (D) auto fun(T)(auto ref T a)
}
D");
}

// Translate wide string literals with L prefix.
unittest
{
assertTMD(q"C
#define H L"hello world"
C", q"D
enum H = "hello world"w;
D");

assertTMD(q"C
#define E L""
C", q"D
enum E = ""w;
D");
}