An array()/map inlining problem

bearophile bearophileHUGS at lycos.com
Tue Sep 7 19:58:01 PDT 2010


This is interesting, if you compile it with:
dmd test.d
It works. If you compile it with:
dmd -inline test.d
It doesn't compile and dmd returns:
test.d(5): Error: function D main is a nested function and cannot be accessed from array


import std.algorithm: map;
import std.array: array;
void main() {
    int c;
    array(map!((x){return c;})([1]));
}


I think this is a compiler bug, right (because I think it must not compile in both cases or compile in both)?

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list