mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-23 06:31:25 +02:00
+ binary operator support for booleans in variants
git-svn-id: trunk@1642 -
This commit is contained in:
parent
ba22b0b3af
commit
c1e968abf9
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -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
38
tests/webtbs/tw4487.pp
Normal 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.
|
||||
|
Loading…
Reference in New Issue
Block a user