Skip to content

Error: Illegal expression

FPC🤖Trunk

program issue;
{$mode delphi}

type
  TObject1<T>=object
    constructor init;
  end;
  TObject2<PT>=object(TObject1<Byte>)
    procedure test;
  end;
  PObject3=^TObject3;
  TObject3=object(TObject2<PObject3>)
  end;

constructor TObject1<T>.init;
begin
end;

procedure TObject2<PT>.test;
const
  typesize = SizeOf(PT(nil)^); // <- Error: Illegal expression
begin
end;

begin
end.
  1. Compile C:\fpclaztrunk\fpc\bin\x86_64-win64\fpc.exe -n -FuC:\fpclaztrunk\fpc\units\x86_64-win64\rtl issue.pas
  2. Get issue.pas(21,30) Error: Illegal expression
Edited by alligator
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information