mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-06-05 14:18:50 +02:00
35 lines
556 B
ObjectPascal
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.
|
|
|