Delphi mode generic class with class constraint isn't allowed to be nilled.
Original Reporter info from Mantis: marco @marcoonthegit
-
Reporter name: Marco van de Voort
Original Reporter info from Mantis: marco @marcoonthegit
- Reporter name: Marco van de Voort
Description:
Delphi allows to nil generic types if they are declared with class constraint.
Steps to reproduce:
{$mode delphi}
type TLockedPool<t:class,constructor> = class
field : T;
procedure xx;
end;
procedure tlockedpool<t>.xx;
begin
field:=nil; // allowed in Delphi, not in FPC
end;
Additional information:
workaround: a viable (and probably even better) is to assign default(T), but this is a compatibility issue.
Mantis conversion info:
- Mantis ID: 38070
- Version: 3.2.0
- Fixed in version: 3.2.1
- Fixed in revision: 47421 (#f8e55c43)