20166, "vasslitvinov", "Are arrays returned by value passable to ref formals?", "2022-07-06T19:39:19Z"
Related: #13106 #20137
Should a ref
formal accept an array returned by a function
with the default return intent? What if it is a const ref
formal and/or
the function's return intent is const
? For example:
proc writeArr(ref X) { // what if X has a `const ref` intent?
writeln(X);
}
proc addEm() { // what if addEm() has a `const` return intent?
return [1,2];
}
writeArr(addEm());
Today all four combinations of {val,const} return intent * {ref, const ref}
argument intent are accepted. Should they be?
Test:
test/users/thom/arrArg-fromFunction.chpl