Skip to content

Implicit function specialization and for inherited fuctions

Summary

Considering the new 90844c20, this code is not correctly compiled.

System Information

Lazarus 2.3.0 (rev main-2_3-1668-g34b3b9a49a) FPC 3.3.1 x86_64-win64-win32/win64

Example Project

program Project1;
 
{$mode objfpc}{$H+}
{$ModeSwitch implicitfunctionspecialization}
 
uses
  Generics.Collections;
 
generic procedure Foo<T>(lst: specialize TEnumerable<T>);
begin
end;
 
var
  lst: specialize TList<Integer>; // Inherits from TEnumerable
begin              
  Foo(lst); // Error
  specialize Foo<Integer>(lst); // works
end.

Related issue: #39677 (closed)

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information