Test case ----------------------- class C6293 { int token; } struct S6293 { const(C6293)[] tokens; void f() const pure { const(C6293) a = tokens[0]; int b = a.token; // <-- separating it is ok. int c = tokens[0].token; // <-- cannot access mutable data 'token' } } ----------------------- x.d(9): Error: pure nested function 'f' cannot access mutable data 'token' ----------------------- If that 'b' can be accessed in a 'pure' function, there's no reason 'c' cannot.
DMD pull #243. https://github.com/D-Programming-Language/dmd/pull/243
*** Issue 6284 has been marked as a duplicate of this issue. ***
Further failing cases: * f(x).member * (*__withSym).member (which is what bug 6284 is about) * ... In a DotVarExp, whenever the 'e1' is not a VarExp or a DotVarExp, the purity check will fail even if 'e1' is already verified as pure.
https://github.com/D-Programming-Language/dmd/commit/1dac08b77af2826996567f629acf7f43d724cd48