Another test case. The error is different but the root cause must be the same.

string bar()
{
    string s = "ab";
    return s[0..$];
}

template T1()
{
    enum T1 = bar()[0..$]; // error
}

string baz()
{
    return T1!();
}

string foo(string s)
{
    return s;
}

static assert(foo(baz()) == "ab");

void main()
{
}

Error: variable __dollar cannot be read at compile time

Reply via email to