[Issue 4820] Regression(1.058, 2.044) in DStress caused by changeset 452

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Sep 6 00:45:13 PDT 2010


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



--- Comment #1 from Don <clugdbug at yahoo.com.au> 2010-09-06 00:44:52 PDT ---
Thanks for the superb bug report!
Reduced test case shows it's nothing to do with lazy:

void nextis(void delegate() dg = {}) {}

void main() {
    nextis();
}

This is failing because function/delegate literals cannot be inlined. Prior to
svn 452, that wasn't being checked in the special case where they were default
parameters. Until bug 2935 was fixed, default values were created in the same
scope as the function declaration. That was a disaster for structs, but might
be OK for function literals -- not sure. Here's an example which used to
compile, but now fails, which never used global scope.

void main() {
   int x = 27;
   int nextis(int delegate() dg = { return x; }) { return dg(); }
   ++x;
   assert(nextis() == 28);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list