www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10065] New: Compiler fails without error message for tuple map

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

           Summary: Compiler fails without error message for tuple map
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: jadit2 gmail.com


--- Comment #0 from Jonathan Dunlap <jadit2 gmail.com> 2013-05-10 18:17:19 PDT
---
module main;

import std.stdio;
import std.file;
import std.path;
import std.string;
import std.conv;
import std.algorithm;
import std.range;
import std.traits;
import std.typetuple;
import std.typecons;

// Sample input file:
// 3 5 10
// 2 7 15
void main(string[] args)
{
        string input;
    writeln("This program is the classic Fizz Buzz application.");
    writeln("It's more fun to let you play your own way.");
    input = chomp(readln());
    input = absolutePath(input);

    assert( input.isFile );
    auto lines = splitLines( readText(input) );
    foreach(line; lines) {
        writeln( getResults(line) );
    }
}

string getResults(string line) 
{
    string[] members = std.regex.split(line, std.regex.regex(" "));
    int A = to!int(members[0]);
    int B = to!int(members[1]);
    int N = to!int(members[2]);

    string outputStr;

    alias Tuple!(int, bool, bool) RuleType;
//====== THE LINE THAT BREAKS THE COMPILER (1 error, no error msg)
    auto lazylist = map!(i => i, i => i % A==0, i => i % B==0)( iota(1, N+1, 1)
);
// =====
    RuleType[] rules = array(lazylist); 

    foreach(RuleType rule; rules) {
        if (rule[1]) outputStr ~= 'F';
        if (rule[2]) outputStr ~= 'B';
        else if (!rule[1]) outputStr ~= to!string(rule[0]);
        outputStr ~= " ";
    }
    return outputStr;
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 10 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10065



--- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2013-05-10 23:23:33 PDT ---
From command line:

   dmd -run main.d

The OP code compilation segfaults with 2.062.

But with 2.063a (git head), compiler prints following error messages and occurs
no segfault.

phobos\std\algorithm.d(404): Error: function std.algorithm.MapResult!(adjoin,
Result).MapResult.back cannot get
frame pointer to adjoin
phobos\std\algorithm.d(438): Error: function std.algorithm.MapResult!(adjoin,
Result).MapResult.front cannot get frame pointer to adjoin
phobos\std\algorithm.d(450): Error: function std.algorithm.MapResult!(adjoin,
Result).MapResult.opIndex cannot get frame pointer to adjoin

What version do you use? The issue might be already fixed in git head.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 10 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10065


Jonathan Dunlap <jadit2 gmail.com> changed:

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


--- Comment #2 from Jonathan Dunlap <jadit2 gmail.com> 2013-06-15 11:53:59 PDT
---
2.063 fixed it.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 15 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10065



--- Comment #3 from Kenji Hara <k.hara.pg gmail.com> 2013-06-16 21:13:07 PDT ---
(In reply to comment #2)
 2.063 fixed it.
Thanks for your confirmation. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 16 2013