Getting a compiler with '-inline'. Is this valid?

Saurabh Das saurabh.das at gmail.com
Tue Mar 11 01:43:10 PDT 2014


Hello,

Consider this simple file 'byLineError.d':

import std.stdio;

void main()
{
     auto f = File("test");
     f.byLine.popFront();
}

When I compile:

dmd byLineError.d --- succeeds

dmd -inline byLineError.d --- fails with 'Internal error: 
backend/cod2.c 2200'

Using dmd version "DMD64 D Compiler v2.065" on Linux.

Am I doing something wrong, or is this a compiler bug? (Maybe 
f.byLine cannot be used in this manner?)

Thanks,
Saurabh

PS: How I came across this: I was trying to scan a file but skip 
the first line, so I wrote:

     auto f = File("test");
     f.byLine.popFront();
     foreach(line; f.byLine)
     {
         writeln(line);
     }

which gave the error.

PPS: This one uses an intermediate variable and succeeds:

void main()
{
     auto f = File("test");
     auto x = f.byLine;
     x.popFront();
}


More information about the Digitalmars-d-learn mailing list