fpc/tests/test/tisconstvalue4.pp
2020-06-25 20:42:47 +00:00

35 lines
556 B
ObjectPascal

{ %FAIL }
program tisconstvalue4;
{$IFDEF FPC}
{$mode Delphi}
{$ENDIF}
type
TMyClass = class
const
PI = 3.14;
private
FNumber: Integer;
public
function DoMathAndReturn(const AValue: Integer): Integer;
published
property MyNumber: Integer read FNumber;
end;
TClassOf = class of TMyClass;
function TMyClass.DoMathAndReturn(const AValue: Integer): Integer;
begin
Result := FNumber * 2;
end;
begin
// Error: type identifier not allowed here
if IsConstValue(TClassOf) then
Halt(1);
Writeln('Ok');
end.