http://d.puremagic.com/issues/show_bug.cgi?id=10485
Andrej Mitrovic <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |[email protected] Resolution| |INVALID --- Comment #2 from Andrej Mitrovic <[email protected]> 2013-06-27 06:49:54 PDT --- Templates can only be used to create declarations, not expressions. One workaround is to write the code like the following: ----- import std.stdio; class TestClass { void call() { writeln("called"); } } mixin template test(string name) { struct S { void call() { scope tc = new TestClass; tc.call(); } } mixin("S " ~ name ~ ";"); } void main(){ mixin test!("var"); var.call(); } ----- But note that 'scope' is a feature that will eventually be deprecated. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
