Internal error 200501152 with undeclared managed operators and record procedures

Summary

With this rather invalid code, I get an Internal error 200501152 after some of the real error messages.

Steps to reproduce

This is the smallest repro I could come up with. Removing almost any component of this prevents the crash.

// test.pas
{$MODE OBJFPC}
program test;
uses testunit;
begin
end.

// testunit.pas
{$MODE OBJFPC}
unit testunit;

interface

implementation

type
   TTest = record
   end;

class operator TTest.Copy(constref Src: TTest; var Dst: TTest);
begin
end;

procedure TTest.Undeclared();
begin
   High(Integer); // Fatal: Internal error 200501152
end;

end.

This code makes no sense (the class operator isn't declared, the procedure isn't declared), but the output from the compiler is:

testunit.pas(12,22) Error: Method identifier expected
testunit.pas(12,63) Error: Impossible operator overload
testunit.pas(16,17) Error: Method identifier expected
testunit.pas(18,9) Fatal: Internal error 200501152

System Information

  • Operating system: Linux
  • Processor architecture: x86-64
  • Compiler version: trunk compiled on 2026/01/30
  • Device: Computer