Bug 2102 – Invalid code generated with nested delegates
Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2008-05-12T16:03:00Z
Last change time
2015-06-09T05:15:01Z
Keywords
wrong-code
Assigned to
ibuclaw
Creator
jeffdavey
Comments
Comment #0 by jeffdavey — 2008-05-12T16:03:13Z
Currently on Ubuntu 8.04 with the packaged GDC 4.2.3, given this code:
import tango.io.Stdout;
void main()
{
char[] blah;
void myFunc()
{
void myOtherFunc()
{
blah ~= "Hello there";
Stdout(blah).newline;
}
myOtherFunc;
}
myFunc;
}
It segfaults when trying to access "blah" in the myOtherFunc delegate.
Using a separate Ubuntu 7.10 box with GDC 4.1, it works as expected (I see "Hello There").
Comment #1 by bugzilla — 2008-06-16T18:04:48Z
This does work correctly with dmd.
Comment #2 by ibuclaw — 2010-08-05T14:49:19Z
This works correctly using gdc with gcc-4.1.2 and gcc-4.3.5, which has now superseded gdc-4.2 in Ubuntu and Debian.