Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
fpc-src / usr / share / fpcsrc / 3.2.0 / tests / test / tgenfunc10.pp
Size: Mime:
{ %NORUN }

{ ensure that specializations with local types are handled correctly }

program tgenfunc10;

{$mode objfpc}

operator := (aOther: LongInt): String;
begin
  Str(aOther, Result);
end;

generic function Test<T>(aArg: T): String;
begin
  Result := aArg.Test;
end;

procedure Test1;
type
  TTest = record
    Test: LongInt;
  end;

var
  s: String;
  t: TTest;
begin
  t.Test := 42;
  s := specialize Test<TTest>(t);
end;

procedure Test2;
type
  TTest = record
    Test: String;
  end;

var
  s: String;
  t: TTest;
begin
  t.Test := 'Hello World';
  s := specialize Test<TTest>(t);
end;

begin
  Test1;
  Test2;
end.