On Sunday, 12 February 2017 at 03:34:19 UTC, Michael Coulombe wrote:

Do you have a complete code example that gives your error? I can't reproduce it (DMD v2.073.0):

int foo(T...)(T vars) {
    int i = 0;
    foreach(ref v ; vars) {
        v = 5;
        i += v;
    }
    return i;
}
void bar(T...)(ref T vars) {
    foreach(ref v ; vars) {
        v = 3;
    }
}
void main() {
    import std.stdio;
    int x = 7;
    bar(x);
    writeln(foo(4,x,8.2)); // 15, no errors
}

Oh... That's really strange; I've updated my code to use non indexed foreach, and it's now building without the error... I have absolutely no idea what caused the error to occur. I've also tried reverting to earlier versions of the project, and I can't recreate the issue. If it occurs again, I'll snapshot the project and try to make a repeatable set up.


Reply via email to