www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12186] New: Problems with partially inferred type for immutable lambda argument

reply d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12186

           Summary: Problems with partially inferred type for immutable
                    lambda argument
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc



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

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 16 2014
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12186


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
           Platform|x86                         |All
         OS/Version|Windows                     |All



https://github.com/D-Programming-Language/dmd/pull/3284

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 18 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12186




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


Issue 12186 - Problems with partially inferred type for immutable lambda
argument

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 23 2014
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12186


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

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


-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 23 2014