mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-08 02:07:53 +02:00
+ support procvar[] in tp/mac procvar mode if the procvar returns an array type
This commit is contained in:
parent
a57e34403c
commit
ec28b7586c
@ -2184,7 +2184,7 @@ implementation
|
||||
begin
|
||||
consume(_CARET);
|
||||
|
||||
{ support tp/mac procvar^ if the procvar returns a
|
||||
{ support in tp/mac procvar mode procvar^ if the procvar returns a
|
||||
pointer type }
|
||||
if ((m_tp_procvar in current_settings.modeswitches) or
|
||||
(m_mac_procvar in current_settings.modeswitches)) and
|
||||
@ -2230,6 +2230,17 @@ implementation
|
||||
|
||||
_LECKKLAMMER:
|
||||
begin
|
||||
{ support in tp/mac procvar mode procvar[] if the procvar returns an
|
||||
array type }
|
||||
if ((m_tp_procvar in current_settings.modeswitches) or
|
||||
(m_mac_procvar in current_settings.modeswitches)) and
|
||||
(p1.resultdef.typ=procvardef) and
|
||||
(tprocvardef(p1.resultdef).returndef.typ=arraydef) then
|
||||
begin
|
||||
p1:=ccallnode.create_procvar(nil,p1);
|
||||
typecheckpass(p1);
|
||||
end;
|
||||
|
||||
if is_class_or_interface_or_object(p1.resultdef) or
|
||||
is_dispinterface(p1.resultdef) or
|
||||
is_record(p1.resultdef) or
|
||||
|
23
tests/tbs/tb0703.pp
Normal file
23
tests/tbs/tb0703.pp
Normal file
@ -0,0 +1,23 @@
|
||||
|
||||
{$mode delphi}
|
||||
uses
|
||||
Types;
|
||||
|
||||
type
|
||||
TArrayFunc = function: TIntegerDynArray;
|
||||
|
||||
function MyFunc : TIntegerDynArray;
|
||||
begin
|
||||
SetLength(Result,1);
|
||||
Result[0]:=$12345678;
|
||||
end;
|
||||
|
||||
var
|
||||
f: TArrayFunc;
|
||||
i: integer;
|
||||
begin
|
||||
f := @MyFunc;
|
||||
i := f[0];
|
||||
if i<>$12345678 then
|
||||
halt(1);
|
||||
end.
|
Loading…
Reference in New Issue
Block a user