Why does this `static foreach` lead to hidden usage of operator `~=` calls in some cases?

static foreach(i; 0 .. cnt)

onlineapp.d(9): Error: cannot use operator ~= in @nogc delegate onlineapp.xv!(myUDA("/")).__funcliteral2.__lambda1




import std.traits;

private @safe pure nothrow @nogc
{
    enum xv(alias uda) = function()
    {
        enum cnt = 10;

        static foreach(i; 0 .. cnt)
        {
        }
    };
}

struct myUDA
{
    string path;
}

@myUDA("/")
void doSth(string path)
{
}

extern(C) void main()
{
    xv!(getUDAs!(doSth, myUDA))();
}


Try: https://run.dlang.io/is/clQgeA

Reply via email to