mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-13 06:29:32 +02:00

with-statement, both in FPC and TP/Delphi modes (mantis #15728) git-svn-id: trunk@14881 -
36 lines
469 B
ObjectPascal
36 lines
469 B
ObjectPascal
program TT;
|
|
|
|
{$mode delphi}
|
|
|
|
uses
|
|
SysUtils;
|
|
|
|
type
|
|
t_R = record
|
|
R1:integer;
|
|
end;
|
|
|
|
t_X = function:t_R;
|
|
|
|
function A:t_R;
|
|
begin
|
|
Result.R1:=123;
|
|
end;
|
|
|
|
var X:t_X;
|
|
|
|
begin
|
|
X:=A;
|
|
if x.r1<>123 then
|
|
halt(1);
|
|
writeln(X.R1); // Error: Illegal qualifier
|
|
writeln(X().R1); // OK
|
|
with X do
|
|
begin
|
|
if r1<>123 then
|
|
halt(2);
|
|
writeln(R1); //Error: Expression type must be class or record
|
|
end;
|
|
with X() do writeln(R1); // OK
|
|
end.
|