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

John Colvin john.loughran.colvin at gmail.com
Tue Mar 11 02:10:55 PDT 2014


On Tuesday, 11 March 2014 at 08:43:11 UTC, Saurabh Das wrote:
> 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();
> }

Internal compiler errors are always bugs. Please report it here: 
https://d.puremagic.com/issues/enter_bug.cgi?product=D


More information about the Digitalmars-d-learn mailing list