www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - 1 compiler error without error message

reply "Jonathan Dunlap" <jadit2 gmail.com> writes:
Building Solution: DFizzBuzz (Debug)



Building: DFizzBuzz (Debug)
Performing main compilation...

Current dictionary: C:\D\Projects\DFizzBuzz\DFizzBuzz
C:\D\dmd2\windows\bin\dmd.exe -debug -gc "main.d"  
"-IC:\D\dmd2\src\druntime\import" "-IC:\D\dmd2\src\phobos" 
"-odobj\Debug" 
"-ofC:\D\Projects\DFizzBuzz\DFizzBuzz\bin\Debug\DFizzBuzz.exe"

Exit code 1
Build complete -- 1 error, 0 warnings
---------------------- Done ----------------------
Build: 1 error, 0 warnings
===============================================

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
	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;
}
May 10 2013
parent reply "Maxim Fomin" <maxim maxim-fomin.ru> writes:
On Saturday, 11 May 2013 at 01:18:47 UTC, Jonathan Dunlap wrote:

This looks like already fixed in git head incorrect error 
gagging. With latest dmd it prints:

DMD v2.063-devel-1215bc3 DEBUG
/usr/include/d/dmd/phobos/std/algorithm.d(404): Error: function 
std.algorithm.MapResult!(adjoin, Result).MapResult.back cannot 
get frame pointer to adjoin
/usr/include/d/dmd/phobos/std/algorithm.d(438): Error: function 
std.algorithm.MapResult!(adjoin, Result).MapResult.front cannot 
get frame pointer to adjoin
/usr/include/d/dmd/phobos/std/algorithm.d(450): Error: function 
std.algorithm.MapResult!(adjoin, Result).MapResult.opIndex cannot 
get frame pointer to adjoin
May 10 2013
next sibling parent "Jonathan Dunlap" <jadit2 gmail.com> writes:
Hmm, it must be an issue then with 2.062. I'll upgrade tomorrow 
and see if that helps. Thanks!

On Saturday, 11 May 2013 at 05:13:18 UTC, Maxim Fomin wrote:
 On Saturday, 11 May 2013 at 01:18:47 UTC, Jonathan Dunlap wrote:

 This looks like already fixed in git head incorrect error 
 gagging. With latest dmd it prints:

 DMD v2.063-devel-1215bc3 DEBUG
 /usr/include/d/dmd/phobos/std/algorithm.d(404): Error: function 
 std.algorithm.MapResult!(adjoin, Result).MapResult.back cannot 
 get frame pointer to adjoin
 /usr/include/d/dmd/phobos/std/algorithm.d(438): Error: function 
 std.algorithm.MapResult!(adjoin, Result).MapResult.front cannot 
 get frame pointer to adjoin
 /usr/include/d/dmd/phobos/std/algorithm.d(450): Error: function 
 std.algorithm.MapResult!(adjoin, Result).MapResult.opIndex 
 cannot get frame pointer to adjoin
May 10 2013
prev sibling parent reply "Jonathan Dunlap" <jadit2 gmail.com> writes:
So what does "Error: function
std.algorithm.MapResult!(adjoin, Result).MapResult.opIndex cannot
get frame pointer to adjoin" actually mean? It's a bit cryptic to 
me.

Thanks!

On Saturday, 11 May 2013 at 05:13:18 UTC, Maxim Fomin wrote:
 On Saturday, 11 May 2013 at 01:18:47 UTC, Jonathan Dunlap wrote:

 This looks like already fixed in git head incorrect error 
 gagging. With latest dmd it prints:

 DMD v2.063-devel-1215bc3 DEBUG
 /usr/include/d/dmd/phobos/std/algorithm.d(404): Error: function 
 std.algorithm.MapResult!(adjoin, Result).MapResult.back cannot 
 get frame pointer to adjoin
 /usr/include/d/dmd/phobos/std/algorithm.d(438): Error: function 
 std.algorithm.MapResult!(adjoin, Result).MapResult.front cannot 
 get frame pointer to adjoin
 /usr/include/d/dmd/phobos/std/algorithm.d(450): Error: function 
 std.algorithm.MapResult!(adjoin, Result).MapResult.opIndex 
 cannot get frame pointer to adjoin
May 11 2013
parent "Maxim Fomin" <maxim maxim-fomin.ru> writes:
On Saturday, 11 May 2013 at 15:53:04 UTC, Jonathan Dunlap wrote:
 So what does "Error: function
 std.algorithm.MapResult!(adjoin, Result).MapResult.opIndex 
 cannot
 get frame pointer to adjoin" actually mean? It's a bit cryptic 
 to me.

 Thanks!
This means that MapResult.opIndex cannot get frame pointer to library nested function adjoin which is used in map template if there are more than 1 arguments passed to map. Either there is situation which requires multiple frame pointers (which is currently impossible) or this is template cross-talk bug.
May 11 2013