www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12451] New: Simple range mistake not caught by compiler

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

           Summary: Simple range mistake not caught by compiler
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs eml.cc 2014-03-24 05:32:39 PDT ---
This code compiles:

void main() {
    import std.algorithm: map, sum;
    int[][][] mat;
    mat.map!(map!sum);
}



While this is wrong code:


void main() {
    import std.algorithm: map, sum;
    int[][] mat;
    mat.map!(map!sum);
}



But the mistake is caught by the linker instead of the dmd, dmd 2.066alpha:

OPTLINK (R) for Win32  Release 8.00.15
Copyright (C) Digital Mars 1989-2013  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
test.obj(test) 
 Error 42: Symbol Undefined _D3std9algorithm38__T9MapResultS18€
sumTAiZ€Š£6__ctorMFNaNbNcNf€ƒžS€ÀÕ

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


monarchdodra gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |monarchdodra gmail.com


--- Comment #1 from monarchdodra gmail.com 2014-03-24 06:24:30 PDT ---
(In reply to comment #0)
 But the mistake is caught by the linker instead of the dmd, dmd 2.066alpha:

I'm getting a compile error on win32 head: std\algorithm.d(469): Error: template std.algorithm.sum cannot deduce function from argument types !()(int), candidates are: std\algorithm.d(1079): std.algorithm.sum(R)(R r) if (isInputRange!R && !isInfinite!R && is(typeof(r.front + r.front))) std\algorithm.d(1090): std.algorithm.sum(R, E)(R r, E seed) if (isInputRange!R && !isInfinite!R && is(typeof(seed = seed + r.front))) std\algorithm.d(503): Error: template std.algorithm.sum cannot deduce function from argument types !()(int), candidates are: std\algorithm.d(1079): std.algorithm.sum(R)(R r) if (isInputRange!R && !isInfinite!R && is(typeof(r.front + r.front))) std\algorithm.d(1090): std.algorithm.sum(R, E)(R r, E seed) if (isInputRange!R && !isInfinite!R && is(typeof(seed = seed + r.front))) std\algorithm.d(515): Error: template std.algorithm.sum cannot deduce function from argument types !()(int), candidates are: std\algorithm.d(1079): std.algorithm.sum(R)(R r) if (isInputRange!R && !isInfinite!R && is(typeof(r.front + r.front))) std\algorithm.d(1090): std.algorithm.sum(R, E)(R r, E seed) if (isInputRange!R && !isInfinite!R && is(typeof(seed = seed + r.front))) std\algorithm.d(416): Error: template instance std.algorithm.MapResult!(sum, int[]) error instantiating std\algorithm.d(469): instantiated from here: map!(int[]) std\algorithm.d(416): instantiated from here: MapResult!(map, int[][]) main.d(11): instantiated from here: map!(int[][]) -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 24 2014
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12451


bearophile_hugs eml.cc changed:

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


--- Comment #2 from bearophile_hugs eml.cc 2014-03-24 11:07:51 PDT ---
(In reply to comment #1)

 I'm getting a compile error on win32 head:
 
 std\algorithm.d(469): Error: template std.algorithm.sum cannot deduce function
 from argument types !()(int), candidates are:
 ...

I have just updated and re-compiled my compiler and indeed the optlink error has being replaced by normal errors. Issue closed and sorry for the noise :-) -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 24 2014