i have two question related to ctfe:
1) returning .idup on local static arrays fail but I don't understand why
that should be:
string foo()
{
char[1] d;
d[0] = 'd';
return d.idup;
}
pragma(msg, foo()); // "Error: cannot evaluate foo() at compile time"
.idup is not mentioned in the section on ctfe in the specs. Should this be
filed as a bug, enhancement request or is it my error?
2) the spec says "expressions in the function may not reference any local
static variables". However, immutable local static variables do seem to
work, like this silly example:
string getDigit(int digit)
{
static immutable(char[10]) digits = "0123456789";
string result;
result ~= digits[digit];
return result;
}
static assert( getDigit(0) == "0" );
Is this ok?