static foreach @nogc

Exil Exil at gmall.com
Thu May 30 02:56:16 UTC 2019


Am I missing something or should this be able to compile? I don't 
know where it is even using ~=, is it used internally for ranges?

struct T
{
@nogc:

auto opBinary(string op, V)(auto ref const(V) vec) const
{
     // Error: cannot use operator ~= in @nogc delegate 
onlineapp.T.opBinary!("+", T).opBinary.__lambda2
     static foreach(i ; 0 .. 1)
     {
     }
     return this;
}
}

void main() {
     T a, b;
     T c = a + b;
}


https://run.dlang.io/is/JDXcJj


More information about the Digitalmars-d mailing list