https://issues.dlang.org/show_bug.cgi?id=12912
Issue ID: 12912 Summary: Lambda function is incorrectly inferred as impure if it uses member field or function Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: rejects-valid Severity: regression Priority: P1 Component: DMD Assignee: nob...@puremagic.com Reporter: verylonglogin....@gmail.com This code should compile: --- struct S(alias fun) { void f() { fun(); } } class C { int n; void f() pure { S!(() => n) s; // `() pure => n` works s.f(); // line 11 } } --- main.d(11): Error: pure function 'main.C.f' cannot call impure function 'main.C.f.S!(delegate () => this.n).S.f' --- This breaks lots of `std.algorithm` usages in `pure` functions. --