mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-12 23:09:40 +02:00
+ added
git-svn-id: trunk@3028 -
This commit is contained in:
parent
e8c2c4abb2
commit
9c14f95ce9
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -6750,6 +6750,7 @@ tests/webtbs/tw4635.pp svneol=native#text/plain
|
||||
tests/webtbs/tw4640.pp svneol=native#text/plain
|
||||
tests/webtbs/tw4669.pp svneol=native#text/plain
|
||||
tests/webtbs/tw4675.pp svneol=native#text/plain
|
||||
tests/webtbs/tw4678.pp -text
|
||||
tests/webtbs/tw4700.pp svneol=native#text/plain
|
||||
tests/webtbs/tw4704.pp -text
|
||||
tests/webtbs/tw4763.pp svneol=native#text/plain
|
||||
|
40
tests/webtbs/tw4678.pp
Normal file
40
tests/webtbs/tw4678.pp
Normal file
@ -0,0 +1,40 @@
|
||||
{ %OPT=-Sd }
|
||||
|
||||
{ Source provided for Free Pascal Bug Report 4678 }
|
||||
{ Submitted by "Phil H." on 2006-01-09 }
|
||||
{ e-mail: pjhess@purdue.edu }
|
||||
program TestVarBug2;
|
||||
|
||||
uses
|
||||
Variants;
|
||||
|
||||
type
|
||||
TMyClass = class
|
||||
private
|
||||
function GetValue(AnInt : Integer) : Variant;
|
||||
public
|
||||
property Value[AnInt : Integer] : Variant read GetValue;
|
||||
end;
|
||||
|
||||
function TMyClass.GetValue(AnInt : Integer) : Variant;
|
||||
begin
|
||||
if AnInt < 0 then
|
||||
Result := Null
|
||||
else
|
||||
Result := AnInt;
|
||||
end;
|
||||
|
||||
var
|
||||
AClass : TMyClass;
|
||||
VarVal : Variant;
|
||||
begin
|
||||
AClass := TMyClass.Create;
|
||||
|
||||
// This statement throws an exception with FPC.
|
||||
// Should assign Null to VarVal as per Delphi rule:
|
||||
// "any operation on a Null variant produces a Null variant".
|
||||
VarVal := AClass.Value[5] + AClass.Value[-1] + 1;
|
||||
|
||||
end.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user