I can't tell if this is a bug, I was just playing with it and it's not important to me: void foo(alias dg)() { dg(); } void test() { foo!({ int x; })(); } void main() { test(); } $ dmd test.d ok $ dmd -inline test.d test.d(3): Error: function test.test.foo!(delegate pure nothrow @safe void() { int x = 0; } ).foo is a nested function and cannot be accessed from main Note that if I make it a delegate literal it will compile: void foo(alias dg)() { dg(); } void test() { int y; foo!({ int x = y; })(); } void main() { test(); } $ dmd -inline test.d ok
*** This issue has been marked as a duplicate of issue 5499 ***