New Issue: Incorrect const error for c_array of tuples

20198, "ronawho", "Incorrect const error for c_array of tuples", "2022-07-12T13:57:13Z"

While trying to optimize some aggregation code for small buffers I was looking to copy a c_ptr buffer into a c_array so that it can be sent along with the on-stmt bundle instead of requiring extra comm. While trying to do so I ran into issues where the compiler believes the c_array is const and can't be assigned too. Here's a small reproducer:

use CTypes;

config param n = 1024;
type elemType = int;
type aggType = (c_ptr(elemType), elemType);

var buf = c_malloc(elemType, n);
var lBuffer = c_malloc(aggType, n);
for i in 0..<n do lBuffer[i] = (c_ptrTo(buf[i]), i);

var stackBuf: c_array(aggType, n);
for i in 0..<n {
  stackBuf[i] = lBuffer[i]; // error: illegal lvalue in assignment
}
chpl cArrayRepro.chpl
cArrayRepro.chpl:13: error: illegal lvalue in assignment