https://issues.dlang.org/show_bug.cgi?id=15631
--- Comment #6 from [email protected] --- Ran into similar problem with delegates: ------------- void fun(void delegate() dg) { dg(); } void main() { int x = 123; string y = "abc"; fun({ x++; y ~= "d"; }); } ------------- Compiled with `dmd -g prog.d`. In gdb: ------------ (gdb) break prog.main Breakpoint 1 at 0x43734: file prog.d, line 8. (gdb) run Starting program: /tmp/prog [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Breakpoint 1, prog.main().__lambda3() (__capture=0x7ffff7cad000) at prog.d:8 8 x++; (gdb) p x No symbol "x" in current context. (gdb) p y No symbol "y" in current context. (gdb) p __capture.x $1 = 123 (gdb) p __capture.y $2 = "abc" ------------ Apparently `__capture` must be entered explicitly in order to access closed-over variables. It would be nice to have symbol lookup automatically look in __capture. --
