View Issue Details

IDProjectCategoryView StatusLast Update
0038070FPCCompilerpublic2020-11-15 17:30
ReporterMarco van de Voort Assigned ToFlorian  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.2.0 
Fixed in Version3.2.1 
Summary0038070: Delphi mode generic class with class constraint isn't allowed to be nilled.
DescriptionDelphi 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 Informationworkaround: a viable (and probably even better) is to assign default(T), but this is a compatibility issue.
Tagsgenerics
Fixed in Revision47421
FPCOldBugId
FPCTarget-
Attached Files

Relationships

duplicate of 0034037 closedFlorian Generics - nil has to be treated as T(nil) 

Activities

Florian

2020-11-14 23:37

administrator   ~0126950

With trunk it works, not sure what needs to be merge though.

Sven Barth

2020-11-15 12:45

manager   ~0126953

Last edited: 2020-11-15 12:46

View 2 revisions

So I did remember correctly that you fixed that already! It's revision 39934 by the way, the fix for 0034037. ;)

Marco van de Voort

2020-11-15 13:43

manager   ~0126955

Sorry guys, I noticed in a project for work, and that is of course using fixes branch.

Florian

2020-11-15 15:17

administrator   ~0126959

Thanks Sven for the revision, I merged it.

Issue History

Date Modified Username Field Change
2020-11-12 14:35 Marco van de Voort New Issue
2020-11-13 15:07 Sven Barth Tag Attached: generics
2020-11-14 23:37 Florian Note Added: 0126950
2020-11-15 12:45 Sven Barth Note Added: 0126953
2020-11-15 12:46 Sven Barth Note Edited: 0126953 View Revisions
2020-11-15 13:43 Marco van de Voort Note Added: 0126955
2020-11-15 15:17 Florian Assigned To => Florian
2020-11-15 15:17 Florian Status new => resolved
2020-11-15 15:17 Florian Resolution open => fixed
2020-11-15 15:17 Florian Fixed in Version => 3.2.1
2020-11-15 15:17 Florian Fixed in Revision => 47421
2020-11-15 15:17 Florian FPCTarget => -
2020-11-15 15:17 Florian Note Added: 0126959
2020-11-15 15:17 Florian Product Version 3.3.1 => 3.2.0
2020-11-15 17:30 Sven Barth Relationship added duplicate of 0034037