You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
Nicholas Wilson (@thewilsonator) reported this on 2019-06-14T10:46:17Z
Transferred from https://issues.dlang.org/show_bug.cgi?id=19963
CC List
Description
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.The text was updated successfully, but these errors were encountered: