External Issue: Chapel internal error RES-PRE-OLD-2591 in function pointer code

17622, "npadmana", "Chapel internal error RES-PRE-OLD-2591 in function pointer code", "2021-05-03T06:58:39Z"

Summary of Problem

Compiling the code below in Chapel 1.24.1 results in an internal error.

Steps to Reproduce

Source Code:

use M1 only Integrator;

var cc = new owned Integrator(R);
cc();


record R {}

module M1 {

  use CPtr;

  class Integrator {
    type T;

    proc this() {
      proc _helper() : real {
        return 0;
      }
      var gf = c_ptrTo(_helper);
    }
  }
}

Compile command:
chpl foo.chpl

fails with

foo.chpl:3: warning: This file-scope code is outside of any explicit module declarations (e.g., module M1), so an implicit module named 'foo' is being introduced to contain the file's contents.
foo.chpl:20: internal error: RES-PRE-OLD-2591 chpl version 1.24.1
Note: This source location is a guess.

Internal errors indicate a bug in the Chapel compiler ("It's us, not you"),
and we're sorry for the hassle.  We would appreciate your reporting this bug -- 
please see https://chapel-lang.org/bugs.html for instructions.  In the meantime,
the filename + line number above may be useful in working around the issue.