class C { void method(alias F = function(int i) {})() { int i; F(i); } } void main() { C c = new C; c.method!(function(int i) {})(); // works c.method(); // core.exception.AssertError@./bug.d(2): null this } AssertError does not occur with: void method(alias F = function() {})() { int i; F(); }
I just ran the snippet, and it does not throw anymore. Closing.