On 07/08/2017 02:29 PM, Andre Pany wrote:

> I use assert(false, tmp) to see the content of variable tmp as it seems
> there is no other way in CTFE.

A more natural way is pragma(msg), which you can use in main in this case:

string test(string s)
{
    string tmp = s;
    tmp = tmp[4..$];
    return tmp;
}

enum foo =
`1234
5678
`;

void main()
{
    enum bar = test(foo);
    pragma(msg, bar);
}

> The output is kind of weired:
> app.d(6): Error: "1234\x0a5678\x0a"[4..10]
> app.d(17):        called from here: test("1234\x0a5678\x0a")

Yes, looks pretty weird. :) I remember issues related to Unicode characters, which may be fixed by now, but the [4..10] part is news to me.

Ali

Reply via email to