Test case ----------------------------- struct S { int a; } pure void bug6284() { S s; auto b = s.a; // ok with (s) { auto c = a; // error } } ----------------------------- x.d(8): Error: pure nested function 'bug6284' cannot access mutable data 'a' ----------------------------- The error does not happen in 2.053, probably due to the stricter pure check in 2.054.
(and yes, the regression is indeed introduced in commit 84b4f "tighten purity checks". https://github.com/D-Programming-Language/dmd/commit/84b4f)
DMD pull #233. https://github.com/D-Programming-Language/dmd/pull/233
DMD pull #243. https://github.com/D-Programming-Language/dmd/pull/243
Merging into bug 6293 as the root causes are the same. *** This issue has been marked as a duplicate of issue 6293 ***
https://github.com/D-Programming-Language/dmd/commit/1dac08b77af2826996567f629acf7f43d724cd48