View Issue Details

IDProjectCategoryView StatusLast Update
0037844FPCCompilerpublic2020-10-16 06:18
Reporterkote_kagbe Assigned ToSven Barth  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Fixed in Version3.3.1 
Summary0037844: compilation of a "specialize" inside a "with" clause returns "Error: Illegal expression"
Descriptionhttps://forum.lazarus.freepascal.org/index.php/topic,51623.0.html

compile-time error while calling a specializaion of a generic function of an object inside a with-clause
Steps To Reproduce{$mode objfpc}
 
type
    generic grec<T> = record
        value: T;
    end;
 
    tmytype = class
    public
    generic function func1<T>( const v: variant ): specialize grec<T>;
    end;

generic function tmytype.func1<T>( const v: variant ): specialize grec<T>;
begin
    result.value := t(v);
end;

begin
...
tmp := tmytype.Create;
with tmp do
    gr := specialize func1<string>( vr ); // <--!!!!!!!!!!!!!!!!!!!
writeln(gr.value);
tmp.Free;
...
end.
Tagsgenerics
Fixed in Revision47101
FPCOldBugId
FPCTarget-
Attached Files

Activities

Maxim Ganetsky

2020-09-30 15:32

reporter   ~0125995

Seems to belong to FPC project.

kote_kagbe

2020-09-30 15:46

reporter   ~0125999

oops, sorry, forgot to change the project
sure it is FPC

Thaddy de Koning

2020-10-03 21:16

reporter   ~0126067

Why do you not declare the few variables that makes your code a full program?
Way easier to test....

kote_kagbe

2020-10-04 09:22

reporter   ~0126072

Sven Barth

2020-10-12 18:55

manager   ~0126263

Please test and close if okay.

Issue History

Date Modified Username Field Change
2020-09-30 14:02 kote_kagbe New Issue
2020-09-30 15:32 Maxim Ganetsky Note Added: 0125995
2020-09-30 15:32 Maxim Ganetsky Project Lazarus => FPC
2020-09-30 15:46 kote_kagbe Note Added: 0125999
2020-09-30 17:55 Mattias Gaertner Assigned To => Mattias Gaertner
2020-09-30 17:55 Mattias Gaertner Status new => assigned
2020-09-30 17:56 Mattias Gaertner Assigned To Mattias Gaertner =>
2020-09-30 19:50 Cyrax Tag Attached: generics
2020-09-30 21:54 Sven Barth Status assigned => new
2020-09-30 21:54 Sven Barth FPCTarget => -
2020-10-03 21:16 Thaddy de Koning Note Added: 0126067
2020-10-04 09:22 kote_kagbe Note Added: 0126072
2020-10-04 09:22 kote_kagbe File Added: generic_error_sample_project.zip
2020-10-12 18:55 Sven Barth Assigned To => Sven Barth
2020-10-12 18:55 Sven Barth Status new => resolved
2020-10-12 18:55 Sven Barth Resolution open => fixed
2020-10-12 18:55 Sven Barth Fixed in Version => 3.3.1
2020-10-12 18:55 Sven Barth Fixed in Revision => 47101
2020-10-12 18:55 Sven Barth Note Added: 0126263
2020-10-16 06:18 kote_kagbe Status resolved => closed