Bug 10065 – Compiler fails without error message for tuple map

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-05-10T18:17:00Z
Last change time
2013-06-16T21:13:07Z
Assigned to
nobody
Creator
jadit2

Comments

Comment #0 by jadit2 — 2013-05-10T18:17:19Z
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; }
Comment #1 by k.hara.pg — 2013-05-10T23:23:33Z
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.
Comment #2 by jadit2 — 2013-06-15T11:53:59Z
2.063 fixed it.
Comment #3 by k.hara.pg — 2013-06-16T21:13:07Z
(In reply to comment #2) > 2.063 fixed it. Thanks for your confirmation.