fpc/tests/webtbf/tw15594a.pp
Jonas Maebe 88f5addd1c * do not typecheck statements before checking whether they are valid,
because the associated simplifications can turn invalid statements
    into valid statements (based on patch by Aleksa Todorovic, mantis
    #15594)

git-svn-id: trunk@14998 -
2010-03-09 21:13:22 +00:00

45 lines
683 B
ObjectPascal

{ %fail }
program project1;
{$mode objfpc}{$H+}
type
{ TBoolObject }
TBoolObject = class(TObject)
private
fBool: Boolean;
procedure SetBool(const AValue: Boolean);
protected
function GetBool: Boolean;
property Bool: Boolean read GetBool write SetBool default True;
end;
TSubBoolObject = class(TBoolObject)
published
property Bool default True;
end;
{ TBoolObject }
procedure TBoolObject.SetBool(const AValue: Boolean);
begin
fBool:=AValue;
end;
function TBoolObject.GetBool: Boolean;
begin
Result:=fBool;
end;
var
b: TSubBoolObject;
begin
b:=TSubBoolObject.Create;
b.Bool=True; // NO ERROR!!! why?????
b.Free;
end.