www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - compiler aborts with std.file.dirEntries

reply MIURA Masahiro <miura accense.com> writes:
Hi,

I got a DMD abort.

---- cut here ----
% cat dmdabort.d
import std.file;

string find_file(string directory)
{
    char[] result;
    foreach (string path; dirEntries(directory, SpanMode.shallow)) {
        string fullpath = std.file.join(directory, path);
        // ...
    }
    return cast(string)result;
}

void main(string[] args)
{
    // writefln("%s", find_file("."));
}
% dmd dmdabort.d
dmd: expression.c:5222: virtual Expression* DotIdExp::semantic(Scope*):
Assertion `0' failed.
zsh: abort      dmd dmdabort.d
%
---- cut here ----

Comment out the "string fullpath =" line and it compiles.
It's DMD 2.017 on Linux.  Any help please?
Jul 23 2008
parent "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"MIURA Masahiro" <miura accense.com> wrote in message 
news:g68u6n$2egk$1 digitalmars.com...
 Hi,

 I got a DMD abort.

 ---- cut here ----
 % cat dmdabort.d
 import std.file;

 string find_file(string directory)
 {
    char[] result;
    foreach (string path; dirEntries(directory, SpanMode.shallow)) {
        string fullpath = std.file.join(directory, path);
        // ...
    }
    return cast(string)result;
 }

 void main(string[] args)
 {
    // writefln("%s", find_file("."));
 }
 % dmd dmdabort.d
 dmd: expression.c:5222: virtual Expression* DotIdExp::semantic(Scope*):
 Assertion `0' failed.
 zsh: abort      dmd dmdabort.d
 %
 ---- cut here ----

 Comment out the "string fullpath =" line and it compiles.
 It's DMD 2.017 on Linux.  Any help please?

Whenever you get an assertion failure in the compiler, it's a bug. Please report it using Bugzilla (http://d.puremagic.com/issues/) if it hasn't been reported already.
Jul 23 2008