mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-11 15:47:51 +02:00
FPC procvar syntax problems
This commit is contained in:
parent
d7fc885b57
commit
cc7b1a48c4
@ -1,5 +1,10 @@
|
|||||||
|
{ this are no bugs, just wrong
|
||||||
|
understanding of FPC syntax }
|
||||||
|
|
||||||
type testfunc = function:longint;
|
type testfunc = function:longint;
|
||||||
|
|
||||||
|
var f : testfunc;
|
||||||
|
|
||||||
var test: testfunc;
|
var test: testfunc;
|
||||||
|
|
||||||
function test_temp: longint;
|
function test_temp: longint;
|
||||||
@ -9,9 +14,29 @@ end;
|
|||||||
|
|
||||||
procedure sound(test: testfunc);
|
procedure sound(test: testfunc);
|
||||||
begin
|
begin
|
||||||
writeln(test);
|
{writeln(test); this is wrong because
|
||||||
|
test is the function itself and write does not know how to
|
||||||
|
output a function !
|
||||||
|
to call test you must use test() !! }
|
||||||
|
writeln(test());
|
||||||
end; { proc. sound }
|
end; { proc. sound }
|
||||||
|
|
||||||
|
var i : longint;
|
||||||
begin
|
begin
|
||||||
sound(test_temp);
|
i:=test_temp;
|
||||||
|
f:=@test_temp;
|
||||||
|
if f()<>i then
|
||||||
|
begin
|
||||||
|
Writeln('error calling f');
|
||||||
|
Halt(1);
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ this works for FPC
|
||||||
|
sound(test_temp);
|
||||||
|
but the correct syntax would be }
|
||||||
|
sound(@test_temp);
|
||||||
|
{ imagine if a function would return its own type !! }
|
||||||
|
|
||||||
|
{ for f var this is correct also ! }
|
||||||
|
sound(f);
|
||||||
end.
|
end.
|
||||||
|
@ -10,8 +10,13 @@ end;
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
if @test <> @test2 then
|
if @test <> @test2 then
|
||||||
writeln('different!');
|
writeln('different!')
|
||||||
|
else
|
||||||
|
writeln('error');
|
||||||
|
m:=@test;
|
||||||
|
|
||||||
if @m <> @test then
|
{ here also the syntax was wrong !! }
|
||||||
writeln('hi!');
|
{ @m <> @test have different types !! }
|
||||||
|
if m <> @test then
|
||||||
|
writeln('error');
|
||||||
end.
|
end.
|
||||||
|
@ -216,6 +216,10 @@ Fixed bugs:
|
|||||||
bug0182.pp @record.field doesn't work in constant expr OK 0.99.9 (PM)
|
bug0182.pp @record.field doesn't work in constant expr OK 0.99.9 (PM)
|
||||||
bug0184.pp multiple copies of the same constant set are stored in executable OK 0.99.9 (PFV)
|
bug0184.pp multiple copies of the same constant set are stored in executable OK 0.99.9 (PFV)
|
||||||
bug0186.pp Erroneous array syntax is accepted. OK 0.99.9 (PFV)
|
bug0186.pp Erroneous array syntax is accepted. OK 0.99.9 (PFV)
|
||||||
|
bug0188.pp can't print function result of procedural var that returns a
|
||||||
|
function. Not a bug : wrong syntax !! See source (PM)
|
||||||
|
bug0189.pp cant compare adresses of function variables !!
|
||||||
|
As bug0188 FPC syntax problem see source (PM)
|
||||||
|
|
||||||
Unproducable bugs:
|
Unproducable bugs:
|
||||||
------------------
|
------------------
|
||||||
@ -250,9 +254,6 @@ bug0171.pp missing typecasting in constant expressions
|
|||||||
bug0183.pp internal error 10
|
bug0183.pp internal error 10
|
||||||
bug0185.pp missing range checking for Val and subrange types
|
bug0185.pp missing range checking for Val and subrange types
|
||||||
bug0187.pp constructor in a WIth statement isn't called correct.
|
bug0187.pp constructor in a WIth statement isn't called correct.
|
||||||
bug0188.pp can't print function result of procedural var that returns a
|
|
||||||
function.
|
|
||||||
bug0189.pp cant compare adresses of function variables !!
|
|
||||||
bug0190.pp can't have typecast for var params ??
|
bug0190.pp can't have typecast for var params ??
|
||||||
bug0191.pp missing vecn constant evaluation
|
bug0191.pp missing vecn constant evaluation
|
||||||
bug0192.pp can't compare boolean result with true/false, because the
|
bug0192.pp can't compare boolean result with true/false, because the
|
||||||
|
Loading…
Reference in New Issue
Block a user