What's the reason that the string literal is a dynamic array, not a static?
So sometimes it is not possible to get string length compile time:

void foo(T: E[N], E, size_t N)(auto ref T data) {
    pragma(msg, "static");
    pragma(msg, data.length);
}
void foo(T: E[], E)(auto ref T data) {
    pragma(msg, "dynamic");
    pragma(msg, data.length);
    // Error: variable data
    // cannot be read at compile time
}
...
foo("test");

Reply via email to