ctfe: .idup on static array and static variables
lutger.blijdestijn at gmail.com
Sun Dec 13 05:34:33 PST 2009
i have two question related to ctfe:
1) returning .idup on local static arrays fail but I don't understand why
that should be:
d = 'd';
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) digits = "0123456789";
result ~= digits[digit];
static assert( getDigit(0) == "0" );
Is this ok?
More information about the Digitalmars-d-learn