Bug 9830 – Wrong purity inference for a lambda?

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2013-03-29T11:44:00Z
Last change time
2014-09-18T00:58:16Z
Keywords
rejects-valid
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2013-03-29T11:44:42Z
I think foo2() too can be pure: void main() { immutable int x; int foo1() pure { return x; } // OK int delegate() pure foo2 = () => x; // error } But DMD 2.063alpha gives: test.d(4): Error: cannot implicitly convert expression (__lambda1) of type int delegate() nothrow @safe to int delegate() pure
Comment #1 by k.hara.pg — 2014-09-18T00:58:16Z
*** This issue has been marked as a duplicate of issue 9148 ***