Bug 12186 – Problems with partially inferred type for immutable lambda argument

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-02-16T16:53:00Z
Last change time
2014-02-23T22:29:50Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2014-02-16T16:53:07Z
Perhaps this shows a compiler problem: void main() { import std.algorithm: map; immutable int[][] mat; mat.map!((in r) => 0); // OK mat.map!((const r) => 0); // OK mat.map!((immutable int[] r) => 0); // OK mat.map!((immutable r) => 0); // Error } DMD 2.065beta3 gives: ...\dmd2\src\phobos\std\algorithm.d(466,23): Error: template D main.__lambda4 cannot deduce function from argument types !()(immutable(int[])), candidates are: test.d(7,14): test.main.__lambda4 ...\dmd2\src\phobos\std\algorithm.d(500,19): Error: template D main.__lambda4 cannot deduce function from argument types !()(immutable(int[])), candidates are: test.d(7,14): test.main.__lambda4 ...\dmd2\src\phobos\std\algorithm.d(512,23): Error: template D main.__lambda4 cannot deduce function from argument types !()(immutable(int[])), candidates are: test.d(7,14): test.main.__lambda4
Comment #1 by k.hara.pg — 2014-02-18T23:38:55Z
Comment #2 by github-bugzilla — 2014-02-23T22:15:24Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/996dad2e96bee06f9fdc13acd7000e874c8d2029 fix Issue 12186 - Problems with partially inferred type for immutable lambda argument https://github.com/D-Programming-Language/dmd/commit/0f04b0b5c12c222f784a16ca227baf10e694f65c Merge pull request #3284 from 9rnsr/fix12186 Issue 12186 - Problems with partially inferred type for immutable lambda argument