compilation of a "specialize" inside a "with" clause returns "Error: Illegal expression"
Original Reporter info from Mantis: kote_kagbe
-
Reporter name: kote_kagbe
Original Reporter info from Mantis: kote_kagbe
- Reporter name: kote_kagbe
Description:
https://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.
Mantis conversion info:
- Mantis ID: 37844
- Version: 2.0.10
- Fixed in version: 3.3.1
- Fixed in revision: 47101 (#e90cf131)