I'd say, I found another compiler bug. ----------------- import std.stdio; template Struct(alias bar) { struct S { void foo() { FancyFunc!(this, bar).fn(); } } } template FancyFunc(alias context, alias f) { void fn() { writeln("before"); f(context); writeln("after"); } } void bar(CT)(CT context) { writeln(CT.stringof); } void main() { alias Struct!(bar).S MyStruct; MyStruct s = MyStruct(); s.foo(); } ---------------------- Compile it with dmd and dmd will print: > Internal error: e2ir.c 1242
Little bit simplified: struct S(alias bar) { void foo() { fn!(this, bar)(); } } void fn(alias context, alias f)() { f(context); } void bar(CT)(CT context) { } void main() { alias S!bar MyStruct; }
Seems to be fixed.