mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-03 03:09:31 +01:00
* procvar difference with smallint - longint should fail
This commit is contained in:
parent
1bd92de936
commit
4d35408f01
31
tests/tbf/tb0138.pp
Normal file
31
tests/tbf/tb0138.pp
Normal file
@ -0,0 +1,31 @@
|
||||
{ %fail }
|
||||
|
||||
type
|
||||
p_int = procedure (var i : smallint);
|
||||
|
||||
procedure testl(var i : longint);
|
||||
begin
|
||||
i:=$ffff;
|
||||
end;
|
||||
|
||||
|
||||
var
|
||||
p : p_int;
|
||||
r : packed record
|
||||
{$ifdef ENDIAN_BIG}
|
||||
j,i : smallint;
|
||||
{$else}
|
||||
i,j : smallint;
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
begin
|
||||
p:=@testl;
|
||||
r.j:=5;
|
||||
p(r.i);
|
||||
if r.j<>5 then
|
||||
begin
|
||||
writeln('Wrong code overwrites j');
|
||||
halt(1);
|
||||
end;
|
||||
end.
|
||||
Loading…
Reference in New Issue
Block a user