+ binary operator support for booleans in variants

git-svn-id: trunk@1642 -
This commit is contained in:
florian 2005-11-04 21:05:18 +00:00
parent ba22b0b3af
commit c1e968abf9
2 changed files with 39 additions and 0 deletions

1
.gitattributes vendored
View File

@ -6347,6 +6347,7 @@ tests/webtbs/tw4398.pp svneol=native#text/plain
tests/webtbs/tw4427.pp svneol=native#text/plain
tests/webtbs/tw4428.pp svneol=native#text/plain
tests/webtbs/tw4450.pp svneol=native#text/plain
tests/webtbs/tw4487.pp -text svneol=unset#text/plain
tests/webtbs/tw4489.pp -text svneol=unset#text/plain
tests/webtbs/ub1873.pp svneol=native#text/plain
tests/webtbs/ub1883.pp svneol=native#text/plain

38
tests/webtbs/tw4487.pp Normal file
View File

@ -0,0 +1,38 @@
{ Source provided for Free Pascal Bug Report 4487 }
{ Submitted by "Phil H." on 2005-11-02 }
{ e-mail: pjhess@purdue.edu }
program TestVarBug;
{$IFDEF FPC}
{$mode objfpc}
uses
Variants;
{$ENDIF}
type
TMyClass = class
private
function GetValue(AsInt : Boolean) : Variant;
public
property Value[AsInt : Boolean] : Variant read GetValue;
end;
function TMyClass.GetValue(AsInt : Boolean) : Variant;
begin
if AsInt then
Result := 1
else
Result := True;
end;
var
AClass : TMyClass;
begin
AClass := TMyClass.Create;
if (AClass.Value[True] = 1) and
AClass.Value[False] then //Throws exception with FPC (requires "= True")
WriteLn('Value is True')
else
WriteLn('Value is False');
end.