Currently D refuses code like this:

void foo(const int[] a) {
    int bar() pure {
        return a[0];
    }
}
void main() {}


With two repeated error messages:

test1.d(3): Error: pure nested function 'bar' cannot access mutable data 'a' test1.d(3): Error: pure nested function 'bar' cannot access mutable data 'a'


But is it possible for D to see that bar function as pure?

Bye,
bearophile

Reply via email to