← board

Nested routines: capture of fixed-size array locals not supported

Symptom

A nested routine that reads or writes a fixed-size array local of its enclosing routine fails to compile:

pascal26:144: error: nested routine: capture of fixed-size array 'rightG' not yet supported ()

Repro shape (rejected):

function Outer: Boolean;
var
  leftG, rightG: array[0..7] of Integer;
  leftN, rightN: Integer;
  onRight: Boolean;

  function AddGroup(v: Integer): Boolean;
  begin
    AddGroup := False;
    if leftN + rightN >= 8 then Exit;
    if onRight then begin rightG[rightN] := v; rightN := rightN + 1; end
    else begin leftG[leftN] := v; leftN := leftN + 1; end;
    AddGroup := True;
  end;

begin
  ...
end;

Scalar captures (leftN, onRight) work; the fixed-size array locals are the missing case. FPC accepts this.

Workaround used

Flattened the helper into the enclosing routine (single g[0..7] array + index bookkeeping inline) — see DnsParseIpv6 in lib/rtl/dns_config.pas.

Acceptance