New Issue: [Bug]: undefined outer variable in task parallel block causes internal error

25639, "jabraham17", "[Bug]: undefined outer variable in task parallel block causes internal error", "2024-07-25T19:05:46Z"

The following code causes an internal error

  coforall i in 1..10 with (ref sum2) {
    sum2 += i;
  }

It does not matter what the intent is, it still hits the internal error. This seems to be specific to task intents, because I get the same behavior with begin and cobegin. However, changing coforall to forall or foreach correctly gives the error "could not find the outer variable for 'sum2'".

Also note, if you remove sum2 += i from the loop (so the loop body is empty), then you also correctly get "could not find the outer variable for 'sum2'".