External Issue: compile error when accessing record fields through a 'const ref'

18647, "BryantLam", "compile error when accessing record fields through a 'const ref'", "2021-10-28T22:13:41Z"

Related #14946?

This code passes a tuple of record-wrapped records into a function with const ref formal. Accessing the wrapper's member variable causes a compile-time error.

module ConstRef {
  record MyData {
    var x: int;

  record Wrapper {
    var val: MyData;

    proc init() {
      this.val = new MyData(0);

  proc doStuff(const ref data_tup: 2*Wrapper) {
    var vals = data_tup[0].val; // <-- compile error

  proc main() {
    var someVal = ( new Wrapper(), new Wrapper() );
15: error: const actual is passed to 'ref' formal 'this' of val()

chpl version 1.25.0

Workaround is to add and call an accessor method in Wrapper instead of directly accessing member variable val, but it doesn't seem like that should be necessary.