[Issue 10614] A delegate erroneously inferred as impure

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Mar 24 22:14:08 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=10614

Kenji Hara <k.hara.pg at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #1 from Kenji Hara <k.hara.pg at gmail.com> ---
(In reply to bearophile_hugs from comment #0)
> struct Foo {
>     immutable int y;
>     void bar(TF)(TF f) pure {
>         f(1);
>     }
>     void spam() pure {
>         bar((int x) => y);
>     }
> }
> void main() {}

By fixing issue 9148, a lambda (int x) => y is deduced to weak purity.
Therefore its call will be accepted in bar.

Will be fixed 2.067 and later.

*** This issue has been marked as a duplicate of issue 9148 ***

--


More information about the Digitalmars-d-bugs mailing list