mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-26 15:10:25 +02:00
+ add a test which ensures that a "const TVarData" parameter is passed as a reference.
This is required for Delphi compatibility as implementers of IVarInvokable or inheritors of TInvokableVariantType need to modify the variant data by using a pointer to the TVarData because it's passed as const and thus not modifyable by itself. This behavior is documented in so far as the C++ builder documentation shows that the same parameter is implemented as "const&". git-svn-id: trunk@48478 -
This commit is contained in:
parent
fe5b29c111
commit
d13838ac0b
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -13982,6 +13982,7 @@ tests/test/cg/tobjsize.pp svneol=native#text/plain
|
||||
tests/test/cg/tpara1.pp svneol=native#text/plain
|
||||
tests/test/cg/tpara2.pp svneol=native#text/plain
|
||||
tests/test/cg/tpara3.pp svneol=native#text/plain
|
||||
tests/test/cg/tpara4.pp svneol=native#text/pascal
|
||||
tests/test/cg/tprintf.pp svneol=native#text/plain
|
||||
tests/test/cg/tprintf2.pp svneol=native#text/plain
|
||||
tests/test/cg/tprintf3.pp svneol=native#text/plain
|
||||
|
22
tests/test/cg/tpara4.pp
Normal file
22
tests/test/cg/tpara4.pp
Normal file
@ -0,0 +1,22 @@
|
||||
{ This test ensures that a "const TVarData" parameter is passed as a reference.
|
||||
This is required for Delphi compatibility as implementers of IVarInvokable or
|
||||
inheritors of TInvokableVariantType need to modify the variant data by using
|
||||
a pointer to the TVarData because it's passed as const and thus not modifyable
|
||||
by itself.
|
||||
This behavior is documented in so far as the C++ builder documentation shows
|
||||
that the same parameter is implemented as "const&". }
|
||||
|
||||
program tpara4;
|
||||
|
||||
var
|
||||
d: TVarData;
|
||||
|
||||
procedure Test(const v: TVarData);
|
||||
begin
|
||||
if @d <> @v then
|
||||
Halt(1);
|
||||
end;
|
||||
|
||||
begin
|
||||
Test(d);
|
||||
end.
|
Loading…
Reference in New Issue
Block a user