mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-07 18:47:52 +02:00
Modify tbs/tb0588.pp to check that a warning is issued about non-initialized return value, moved to tbf directory
git-svn-id: trunk@40521 -
This commit is contained in:
parent
c32c6c4cd6
commit
e7aadde92f
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -11080,6 +11080,7 @@ tests/tbf/tb0262.pp svneol=native#text/pascal
|
||||
tests/tbf/tb0263.pp svneol=native#text/pascal
|
||||
tests/tbf/tb0264.pp svneol=native#text/pascal
|
||||
tests/tbf/tb0265.pp svneol=native#text/pascal
|
||||
tests/tbf/tb0588.pp svneol=native#text/pascal
|
||||
tests/tbf/ub0115.pp svneol=native#text/plain
|
||||
tests/tbf/ub0149.pp svneol=native#text/plain
|
||||
tests/tbf/ub0158a.pp svneol=native#text/plain
|
||||
@ -11671,7 +11672,6 @@ tests/tbs/tb0584.pp svneol=native#text/pascal
|
||||
tests/tbs/tb0585.pp svneol=native#text/pascal
|
||||
tests/tbs/tb0586.pp svneol=native#text/pascal
|
||||
tests/tbs/tb0587.pp svneol=native#text/plain
|
||||
tests/tbs/tb0588.pp svneol=native#text/pascal
|
||||
tests/tbs/tb0589.pp svneol=native#text/pascal
|
||||
tests/tbs/tb0590.pp svneol=native#text/pascal
|
||||
tests/tbs/tb0591.pp svneol=native#text/pascal
|
||||
|
32
tests/tbf/tb0588.pp
Normal file
32
tests/tbf/tb0588.pp
Normal file
@ -0,0 +1,32 @@
|
||||
{ %FAIL }
|
||||
{ %opt=-O4 -Sew }
|
||||
|
||||
{ This code can generate trouble because
|
||||
uninitialized retrun value in f method
|
||||
can have a pattern that generates a
|
||||
floating point exception later.
|
||||
|
||||
As core decided not to generate an error in such cases,
|
||||
this test was modified to al least test that a warning
|
||||
is issued about non-initialized return value. }
|
||||
|
||||
{$mode objfpc}
|
||||
uses
|
||||
sysutils;
|
||||
type
|
||||
tmyclass = class
|
||||
function f : double;virtual;
|
||||
end;
|
||||
|
||||
function tmyclass.f : double;
|
||||
begin
|
||||
end;
|
||||
|
||||
var
|
||||
myclass : tmyclass;
|
||||
begin
|
||||
myclass:=tmyclass.create;
|
||||
writeln(myclass.f+myclass.f+myclass.f);
|
||||
myclass.free;
|
||||
writeln('ok');
|
||||
end.
|
@ -1,21 +0,0 @@
|
||||
{ %opt=-O4 }
|
||||
{$mode objfpc}
|
||||
uses
|
||||
sysutils;
|
||||
type
|
||||
tmyclass = class
|
||||
function f : double;virtual;
|
||||
end;
|
||||
|
||||
function tmyclass.f : double;
|
||||
begin
|
||||
end;
|
||||
|
||||
var
|
||||
myclass : tmyclass;
|
||||
begin
|
||||
myclass:=tmyclass.create;
|
||||
writeln(myclass.f+myclass.f+myclass.f);
|
||||
myclass.free;
|
||||
writeln('ok');
|
||||
end.
|
Loading…
Reference in New Issue
Block a user