diff --git a/dstep/translator/MacroDefinition.d b/dstep/translator/MacroDefinition.d index 1775c982..12a492c7 100644 --- a/dstep/translator/MacroDefinition.d +++ b/dstep/translator/MacroDefinition.d @@ -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; diff --git a/tests/unit/MacroTranslTests.d b/tests/unit/MacroTranslTests.d index 6a7cb3c3..59caab63 100644 --- a/tests/unit/MacroTranslTests.d +++ b/tests/unit/MacroTranslTests.d @@ -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"); +}