External Issue: [Bug]: 'const' attached to vararg formal arguments allows their modification

25858, "ty1027", "[Bug]: 'const' attached to vararg formal arguments allows their modification", "2024-09-03T18:28:40Z"

Summary of Problem

Description:

The following code receives multiple arguments as a tuple (args) and attempts to modify
the 1st element of the tuple. (ATO)

// proc myPrintln(args...) // (*1)
proc myPrintln(const args...) // (*2)
{
  writeln("args.type     = ", args.type:string);
  writeln("args (before) = ", args);

  args[0] *= 10;  // modify tuple (just for test)

  writeln("args (after) = ", args);
}

myPrintln(1, 2.3, "four");

With no const attached (as in Line (*1)), the code prints

args (after) = (10, 2.3, four)

as expected. On the other hand, if I attach const to args (as in Line (*2)),
the code still prints the same result, so allowing the modification of args.

I posted the above code in the Chapel Discourse (in this thread), and Brad suggests that it may be a compiler bug
(based on another example code for tuples). Please take a look at the above
Discourse page for Brad's test code and explanations.

Is this issue currently blocking your progress?
No. (I happened to observe this behavior when playing with vararg for practice).

Steps to Reproduce

I tested the code with the above ATO site.