[Issue 10859] New: Problem with array() of a map Range of simple tuples

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Aug 20 07:31:27 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10859

           Summary: Problem with array() of a map Range of simple tuples
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2013-08-20 07:31:25 PDT ---
I don't know if this is a regression. Here "words.txt" is just a file of words
separated by a newline:


import std.stdio: File;
import std.algorithm: map;
import std.typecons: tuple;
import std.array: array;
void main() {
    File("words.txt")
    .byLine
    .map!(line => tuple(line))
    .array
    ;
}


If I compile with -g it gives at run-time, dmd 2.064alpha:


core.exception.AssertError at std.algorithm(1927): Assertion failure
----------------
0x00424903 in onAssertError
0x0040ED86 in pure nothrow @safe void
std.typecons.Tuple!(char[]).Tuple.opAssign!(std.typecons.Tuple!(char[]).Tuple).opAssign(std.typecons.Tuple!(char[]).Tuple)
at ...\dmd2\src\phobos\std\typecons.d(525)
0x0040F5A4 in pure nothrow @safe void
std.array.Appender!(std.typecons.Tuple!(char[]).Tuple[]).Appender.put!(std.typecons.Tuple!(char[]).Tuple).put(std.typecons.Tuple!(char[]).Tuple)
at ...\dmd2\src\phobos\std\array.d(2347)
0x0040EE72 in
D3std5array116__T5arrayTS6test5b4main80__T9MapResultS226test5b4main9__lambda2TS3std5stdio4File1F8E0F5CC6B0162C488BCADE9A33A8B01
at ...\dmd2\src\phobos\std\array.d(70)
0x00402087 in _Dmain at ...\test5b.d(7)
0x0041C580 in extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int
function(char[][])*).void runMain()
0x0041C610 in extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int
function(char[][])*).void runAll()
0x0041BEED in _d_run_main
0x004084D0 in main
0x00432825 in mainCRTStartup
0x7691D2E9 in BaseThreadInitThunk
0x76FB1603 in RtlInitializeExceptionChain
0x76FB15D6 in RtlInitializeExceptionChain
----------------


If inside the main I replace "array" with "writeln" the program works
correctly.

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


More information about the Digitalmars-d-bugs mailing list