Add a future assigning to the index variable in a loop with non-var iterator

The index variable should be const in these cases, so there should be a compile time error message when trying to assign to it.