mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-17 00:19:38 +02:00
* fix type determining of array of integer constructors
git-svn-id: trunk@4736 -
This commit is contained in:
parent
1eeb78379f
commit
75dee03578
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -7340,6 +7340,7 @@ tests/webtbs/tw7372.pp svneol=native#text/plain
|
||||
tests/webtbs/tw7379.pp svneol=native#text/plain
|
||||
tests/webtbs/tw7425.pp svneol=native#text/plain
|
||||
tests/webtbs/tw7440.pp svneol=native#text/plain
|
||||
tests/webtbs/tw7446.pp svneol=native#text/plain
|
||||
tests/webtbs/ub1873.pp svneol=native#text/plain
|
||||
tests/webtbs/ub1883.pp svneol=native#text/plain
|
||||
tests/webtbs/uw0555.pp svneol=native#text/plain
|
||||
|
@ -653,7 +653,7 @@ implementation
|
||||
ccallparanode.create(
|
||||
ctypeconvnode.create_internal(right,voidpointertype),
|
||||
ccallparanode.create(
|
||||
ctypeconvnode.create_internal(left,voidpointertype),
|
||||
ctypeconvnode.create_internal(left,voidpointertype),
|
||||
nil)));
|
||||
result:=ccallnode.createintern('fpc_intf_assign_by_iid',hp);
|
||||
|
||||
@ -896,11 +896,19 @@ implementation
|
||||
htype:=hp.left.resulttype
|
||||
else
|
||||
begin
|
||||
if ((nf_novariaallowed in flags) or (not varia)) and
|
||||
(not equal_defs(htype.def,hp.left.resulttype.def)) then
|
||||
begin
|
||||
varia:=true;
|
||||
end;
|
||||
if (not varia) and (not equal_defs(htype.def,hp.left.resulttype.def)) then
|
||||
begin
|
||||
{ If both are integers we need to take the type that can hold both
|
||||
defs }
|
||||
if is_integer(htype.def) and is_integer(hp.left.resulttype.def) then
|
||||
begin
|
||||
if is_in_limit(htype.def,hp.left.resulttype.def) then
|
||||
htype:=hp.left.resulttype;
|
||||
end
|
||||
else
|
||||
if (nf_novariaallowed in flags) then
|
||||
varia:=true;
|
||||
end;
|
||||
end;
|
||||
inc(len);
|
||||
hp:=tarrayconstructornode(hp.right);
|
||||
|
31
tests/webtbs/tw7446.pp
Executable file
31
tests/webtbs/tw7446.pp
Executable file
@ -0,0 +1,31 @@
|
||||
program openarrayoverload;
|
||||
{$ifdef FPC}{$mode objfpc}{$h+}{$INTERFACES CORBA}{$endif}
|
||||
{$ifdef mswindows}{$apptype console}{$endif}
|
||||
uses
|
||||
{$ifdef FPC}{$ifdef linux}cthreads,{$endif}{$endif}
|
||||
sysutils;
|
||||
|
||||
type
|
||||
integerarty = array of integer;
|
||||
booleanarty = array of boolean;
|
||||
|
||||
function o2d(const values: array of integer): integerarty;
|
||||
overload;
|
||||
begin
|
||||
result:= nil;
|
||||
end;
|
||||
|
||||
function o2d(const values: array of boolean): booleanarty;
|
||||
overload;
|
||||
begin
|
||||
result:= nil;
|
||||
end;
|
||||
|
||||
var
|
||||
ar1: integerarty;
|
||||
|
||||
begin
|
||||
ar1:= o2d([127,2,3]); // OK
|
||||
ar1:= o2d([128,2,3]);
|
||||
// openarrayoverload.pas(27,8) Error: Can't determine which overloaded function to call
|
||||
end.
|
Loading…
Reference in New Issue
Block a user