www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15459] New: stdio.byLine.each!(map!somefunc) compiles, fails

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

          Issue ID: 15459
           Summary: stdio.byLine.each!(map!somefunc) compiles, fails to
                    link with ld
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Keywords: link-failure
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: eiderdaus gmail.com

http://dpaste.dzfl.pl/ce501c212d32

This code calls byLine, each, map!somefunc. It compiles fine, but fails to
link. Tested on my Linux machine with DMD 2.069.2 and on dpaste with DMD
2.069.1.

Expected: Either an error during compilation, or a well-linked executable.

Code copied here for convenience:

    #!/usr/bin/rdmd

    import std.stdio;
    import std.algorithm;

    char somefunc(in char c)
    {
        return c;
    }

    void main()
    {
        stdin
            .byLine
            .each!(map!somefunc);
    }

dmd outputs:

/d773/f942.o: In function
`_D3std9algorithm9iteration32__T3mapS21_D4f9428somefuncFxaZaZ11__T3mapTAaZ3mapFNaNbNiNfAaZS3std9algorithm9iteration41__T9MapResultS21_D4f9428somefuncFxaZaTAaZ9MapResult':
/d773/f942.d:(.text._D3std9algorithm9iteration32__T3mapS21_D4f9428somefuncFxaZaZ11__T3mapTAaZ3mapFNaNbNiNfAaZS3std9algorithm9iteration41__T9MapResultS21_D4f9428somefuncFxaZaTAaZ9MapResult+0x30):
undefined reference to
`_D3std9algorithm9iteration41__T9MapResultS21_D4f9428somefuncFxaZaTAaZ9MapResult6__ctorMFNaNbNcNiNfAaZS3std9algorithm9iteration41__T9MapResultS21_D4f9428somefuncFxaZaTAaZ9MapResult'
collect2: error: ld returned 1 exit status --- errorlevel 1

--
Dec 16 2015