[Issue 1084] New: lazy variadic parameters break in strange way

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 28 11:13:15 PDT 2007


http://d.puremagic.com/issues/show_bug.cgi?id=1084

           Summary: lazy variadic parameters break in strange way
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P3
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: default_357-line at yahoo.de


Consider the following code.

import std.stdio;
char[] test() { writefln("Eval test"); return "bla"; }
void test2(lazy char[][] bla ...) { foreach (elem; bla) writefln(elem);}
void main() { test2(test, test); }

It compiles (verified gdc .21/dmd .175 by h3 [I couldn't find anybody with
1.010; volunteers appreciated]), but when run, outputs

Eval test
Eval test
bla
<garbage>

Some observations:
 - returning "bla".dup doesn't help.
 - The garbage seems to be an array with the same length as whatever was
returned from test. I did not check to see where the pointer goes. Maybe that
might offer some clue.

If this has already been fixed in 1.010, sorry for wasting your time.
greetings&stuffies --downs


-- 



More information about the Digitalmars-d-bugs mailing list