On Sunday, 20 January 2013 at 14:51:51 UTC, Philippe Sigaud wrote:
On Sun, Jan 20, 2013 at 3:21 PM, Zhenya <zh...@list.ru> wrote:
Hi!
Am I doing something wrong?

import std.stdio;

template gun(alias f)
{
        void gun()
        {
                f();
        }
}

void main()
{
        auto str = "hello";
enum fun = (){writeln(str);};//replace enum -> auto to compile
        gun!fun();
}

fun depends on str, which is a runtime value. Either make str an enum or put them in the module scope (which will make the auto's enum's)
Thank you!

Reply via email to