Implicit Function Specialization broken with overload and string
Summary
I updated to today FPC and a complicated project got broken on compile with multiple internal errors and exceptions in compiler. I can not find the reason or the commit that broke FPC, but I managed to make a minimal sample to show the weird case. Can anyone who maybe changed related mechanism check this? I got stuck with no way to fix as the whole code has units and cases like this.
Error is Error: Internal error 2021020904
.
System Information
Lazarus 4.99 (rev dfb7c2bd04) FPC 3.3.1 x86_64-win64-win32/win64
Example Project
program project1;
{$mode delphi}
{$modeswitch implicitfunctionspecialization}
uses
Unit1;
procedure Test(A: string; B: string); overload;
begin
end;
procedure Test<T>; overload;
begin
end;
begin
Test('aa', 'bb');
end.
unit Unit1;
{$mode delphi}
interface
procedure Test<T>(A: T); overload;
implementation
procedure Test<T>(A: T);
begin
end;
end.
What is the current bug behavior?
- FPC can not choose the correct procedure.
- If I change the parameters to 'a' and 'b' it will work as their type changes to char. Seems irreverent to the issue.
- If I remove the Unit1, it will work.
- If I move the procedure from Unit1 to project, it will work.