mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-06-03 08:58:32 +02:00
* only allow implicit type conversions from dynamic arrays to voidpointer
in Delphi mode, rather than to any pointer type (confused overload selection in mantis #13639) git-svn-id: trunk@13079 -
This commit is contained in:
parent
80fe51380d
commit
5a09f58526
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -8845,6 +8845,7 @@ tests/webtbs/tw13596a.pp svneol=native#text/plain
|
|||||||
tests/webtbs/tw13622.pp svneol=native#text/plain
|
tests/webtbs/tw13622.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw13628a.pp svneol=native#text/plain
|
tests/webtbs/tw13628a.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw13628b.pp svneol=native#text/plain
|
tests/webtbs/tw13628b.pp svneol=native#text/plain
|
||||||
|
tests/webtbs/tw13639.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw1364.pp svneol=native#text/plain
|
tests/webtbs/tw1364.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw1365.pp svneol=native#text/plain
|
tests/webtbs/tw1365.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw1374.pp svneol=native#text/plain
|
tests/webtbs/tw1374.pp svneol=native#text/plain
|
||||||
|
@ -1013,7 +1013,8 @@ implementation
|
|||||||
else
|
else
|
||||||
{ dynamic array to pointer, delphi only }
|
{ dynamic array to pointer, delphi only }
|
||||||
if (m_delphi in current_settings.modeswitches) and
|
if (m_delphi in current_settings.modeswitches) and
|
||||||
is_dynamic_array(def_from) then
|
is_dynamic_array(def_from) and
|
||||||
|
is_voidpointer(def_to) then
|
||||||
begin
|
begin
|
||||||
eq:=te_equal;
|
eq:=te_equal;
|
||||||
end;
|
end;
|
||||||
|
55
tests/webtbs/tw13639.pp
Normal file
55
tests/webtbs/tw13639.pp
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
program t2;
|
||||||
|
|
||||||
|
{$IFDEF FPC}
|
||||||
|
{$mode Delphi}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
uses
|
||||||
|
SysUtils;
|
||||||
|
|
||||||
|
type
|
||||||
|
Tb = array of byte;
|
||||||
|
int = integer;
|
||||||
|
TMeS = class
|
||||||
|
private
|
||||||
|
FD: Tb;
|
||||||
|
Fp: Integer;
|
||||||
|
public
|
||||||
|
constructor Create(cty: int);
|
||||||
|
procedure Write(const Buffer: TB; Offset: int; Count: int); overload;
|
||||||
|
procedure Write(Buffer: PAnsiChar; Offset: int; Count: int); overload;
|
||||||
|
end;
|
||||||
|
|
||||||
|
constructor TMeS.Create(cty: int);
|
||||||
|
begin
|
||||||
|
inherited Create;
|
||||||
|
SetLength(FD, cty);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMeS.Write(Buffer: PAnsiChar; Offset: int; Count: int);
|
||||||
|
begin
|
||||||
|
Move(Buffer[Offset], PAnsiChar(@FD[FP])^, Count);
|
||||||
|
Inc(FP, Count);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMeS.Write(const Buffer: TB; Offset: int; Count: int);
|
||||||
|
begin
|
||||||
|
Write(PAnsiChar(@Buffer[0]), Offset, Count);
|
||||||
|
end;
|
||||||
|
|
||||||
|
var vmes:tmes;
|
||||||
|
|
||||||
|
const vac:string='test1 copy string';
|
||||||
|
vtb:string='test2 copy bytes 10';
|
||||||
|
|
||||||
|
var
|
||||||
|
s: string;
|
||||||
|
begin
|
||||||
|
vmes:=tmes.Create(16);
|
||||||
|
vmes.write(Pansichar(vac),1,10);
|
||||||
|
vmes.Write(tb(vtb),10,5);
|
||||||
|
writeln('"',string(vmes.FD),'"');
|
||||||
|
s:=pchar(vmes.fd);
|
||||||
|
if (s<>'est1 copy byte') then
|
||||||
|
halt(1);
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user