BUG? lazy argument + variadic arguments
Ville Mattila
ville.mattila at iki.fi
Sun Jan 7 02:09:08 PST 2007
Hello,
I'm very new to d. I'm testing lazy evaluation and it seems like
I've found bug w/ dmd compiler on linux. Here are the details.
-- foo.d ---
import std.stdio;
import std.stdarg;
import std.string, std.conv, std.stream;
void foo(lazy void expression, ...)
{
//expression();
if (_arguments.length > 0) {
_arguments[0].print();
//writefln("got vararg:" ~ _arguments[0].name);
if ((_arguments[0]) == typeid(char[])) {
writefln("got vararg:" ~ std.conv.toString(_arguments.length));
char[] tmp_msg = va_arg!(char[])(_argptr);
writefln("GOOTT vararg: " ~ tmp_msg);
}
}
}
int main(char[][] args)
{
foo(writefln("barz"),"foo");
return(0);
}
--- foo.d ----
./foo
char[]
got vararg:1
Segmentation fault (core dumped)
mulperi at mulperi-desktop:/usr/local/src/apps/d/dmd/samples/d$ dmd --help
Digital Mars D Compiler v1.0
Copyright (c) 1999-2007 by Digital Mars written by Walter Bright
Documentation: www.digitalmars.com/d/index.html
Usage:
dmd files.d ... { -switch }
I'm usring xubuntu 6.10 w/ latest patches.
- Ville
More information about the Digitalmars-d-learn
mailing list