mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-07 12:07:58 +02:00

procedures with const and value parameters with temps, allowing a bit more value propagation + tinline6.pp for testing wrong propagation of value parameters in dangerous situations git-svn-id: trunk@1914 -
44 lines
497 B
ObjectPascal
44 lines
497 B
ObjectPascal
{$inline on}
|
|
{$mode objfpc}
|
|
|
|
type
|
|
tc = class
|
|
lf: longint;
|
|
procedure t(l: longint); inline;
|
|
end;
|
|
|
|
var
|
|
a: longint;
|
|
|
|
procedure tc.t(l: longint); inline;
|
|
begin
|
|
lf := 10;
|
|
if (l <> 5) then
|
|
begin
|
|
writeln('error class');
|
|
halt(1);
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure t(l: longint); inline;
|
|
begin
|
|
a := 10;
|
|
if (l <> 5) then
|
|
begin
|
|
writeln('error proc');
|
|
halt(1);
|
|
end;
|
|
end;
|
|
|
|
var
|
|
c: tc;
|
|
|
|
begin
|
|
c := tc.create;
|
|
c.lf := 5;
|
|
c.t(c.lf);
|
|
a := 5;
|
|
t(a);
|
|
end.
|