mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-20 10:09:17 +02:00
bugs 242-245
This commit is contained in:
parent
13b4e5f347
commit
12ec9e475d
26
tests/tbf0245.pp
Normal file
26
tests/tbf0245.pp
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
const
|
||||||
|
r = 3.5;
|
||||||
|
s = 'test idiot';
|
||||||
|
type
|
||||||
|
preal = ^real;
|
||||||
|
pstring = ^string;
|
||||||
|
|
||||||
|
procedure ss;
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
p : pointer;
|
||||||
|
pr : preal;
|
||||||
|
ps : pstring;
|
||||||
|
|
||||||
|
begin
|
||||||
|
p:=@ss;
|
||||||
|
p:=@s;
|
||||||
|
pr:=@r;
|
||||||
|
ps:=@s;
|
||||||
|
pr^:=7.8;
|
||||||
|
ps^:='test3';
|
||||||
|
Writeln('r=',r,' s=',s);
|
||||||
|
end.
|
||||||
|
|
28
tests/tbs0242b.pp
Normal file
28
tests/tbs0242b.pp
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
|
||||||
|
const
|
||||||
|
test = 5;
|
||||||
|
|
||||||
|
procedure test_const(const s : string;const x);
|
||||||
|
begin
|
||||||
|
writeln(s,' is ',longint(x));
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure change(var x);
|
||||||
|
begin
|
||||||
|
inc(longint(x));
|
||||||
|
end;
|
||||||
|
const i : longint = 12;
|
||||||
|
var
|
||||||
|
j : longint;
|
||||||
|
begin
|
||||||
|
j:=34;
|
||||||
|
test_const('Const 5',5);
|
||||||
|
test_const('Untyped const test',test);
|
||||||
|
test_const('Typed_const i',i);
|
||||||
|
test_const('Var j',j);
|
||||||
|
{test_const('i<>j ',i<>j);}
|
||||||
|
change(i);
|
||||||
|
change(j);
|
||||||
|
{ change(test);
|
||||||
|
change(longint); }
|
||||||
|
end.
|
35
tests/tbs0243.pp
Normal file
35
tests/tbs0243.pp
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
program simpletest;
|
||||||
|
|
||||||
|
var i : longint;
|
||||||
|
|
||||||
|
function _next : longint;
|
||||||
|
begin
|
||||||
|
inc(i);
|
||||||
|
_next:=i;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure test(a,b : longint);
|
||||||
|
begin
|
||||||
|
Writeln('first arg is ',a);
|
||||||
|
Writeln('second arg is ',b);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure check(a,b : longint);
|
||||||
|
begin
|
||||||
|
if a>b then
|
||||||
|
begin
|
||||||
|
Writeln('FPC does not follow PASCAL rules for parameter passing');
|
||||||
|
Halt(1);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
{ this could give
|
||||||
|
first arg is 1
|
||||||
|
second arg is 2
|
||||||
|
but FPC parses the second arg before the first one ! }
|
||||||
|
test(_next,_next);
|
||||||
|
writeln('third arg is ',_next);
|
||||||
|
writeln('fourth arg is ',_next,' fifth arg is ',_next);
|
||||||
|
check(_next,_next);
|
||||||
|
end.
|
24
tests/tbs0244.pp
Normal file
24
tests/tbs0244.pp
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
Unit bug0244;
|
||||||
|
|
||||||
|
{test also with -So !!!}
|
||||||
|
|
||||||
|
Interface
|
||||||
|
|
||||||
|
Procedure t(a,b: longint);
|
||||||
|
|
||||||
|
Implementation
|
||||||
|
|
||||||
|
Procedure t(a,b: longint);
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
|
||||||
|
Procedure t2;
|
||||||
|
|
||||||
|
Procedure t(l: Longint);
|
||||||
|
Begin
|
||||||
|
End;
|
||||||
|
|
||||||
|
Begin
|
||||||
|
End;
|
||||||
|
|
||||||
|
End.
|
Loading…
Reference in New Issue
Block a user