variable x cannot be read at compile time (ctfe)
bearophile
bearophileHUGS at lycos.com
Mon Dec 17 06:56:03 PST 2012
> I think it's a problem of nested delegates at CT. But if this
> is the problem, dmd used to give a more clear error message.
Two minimized programs that show the problems:
-------------
import std.algorithm: filter;
import std.array: array;
auto foo(in int x) {
return [1, 2].filter!(i => x)();
}
enum a = foo(3).array();
void main() {}
temp.d(4): Error: variable x cannot be read at compile time
-------------
import std.array: array;
enum a = [1, 2].array();
void main() {}
...\src\druntime\import\core\memory.d(251): Error:
gc_malloc cannot be interpreted at compile time, because it has
no available source code
-------------
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list