From the source code of DMD no less! void f() { int fx; pure void g() { int gx; /+pure+/ void h() { int hx; /+pure+/ void i() { fx = 0; } } } } should give Error: pure nested function 'g' cannot access mutable data 'fx' if the commented out `purees are removed it should give Error: pure nested function 'i' cannot access mutable data 'fx' three times.
*** Issue 19964 has been marked as a duplicate of this issue. ***
I'm not sure what the problem is?
The problem is that function g is pure, but it contains function i that accesses the variable fx which is outside of its scope, thus violating purity. This code should issue an error, but it doesn't.
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19584 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB