mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-05 08:50:19 +02:00
* allow exit(value) in exception blocks. Forbidding this dates back to
when this construct was still handled by custom code (mantis #16803) git-svn-id: trunk@15492 -
This commit is contained in:
parent
5dd72acf36
commit
60041ebf8b
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -10521,6 +10521,7 @@ tests/webtbs/tw16757.pp svneol=native#text/plain
|
|||||||
tests/webtbs/tw1677.pp svneol=native#text/plain
|
tests/webtbs/tw1677.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw16770.pp svneol=native#text/plain
|
tests/webtbs/tw16770.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw16772.pp svneol=native#text/plain
|
tests/webtbs/tw16772.pp svneol=native#text/plain
|
||||||
|
tests/webtbs/tw16803.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw1681.pp svneol=native#text/plain
|
tests/webtbs/tw1681.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw1696.pp svneol=native#text/plain
|
tests/webtbs/tw1696.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw1699.pp svneol=native#text/plain
|
tests/webtbs/tw1699.pp svneol=native#text/plain
|
||||||
|
@ -298,14 +298,7 @@ implementation
|
|||||||
begin
|
begin
|
||||||
p1:=comp_expr(true);
|
p1:=comp_expr(true);
|
||||||
consume(_RKLAMMER);
|
consume(_RKLAMMER);
|
||||||
if (block_type=bt_except) then
|
if (not assigned(current_procinfo) or
|
||||||
begin
|
|
||||||
Message(parser_e_exit_with_argument_not__possible);
|
|
||||||
{ recovery }
|
|
||||||
p1.free;
|
|
||||||
p1:=nil;
|
|
||||||
end
|
|
||||||
else if (not assigned(current_procinfo) or
|
|
||||||
is_void(current_procinfo.procdef.returndef)) then
|
is_void(current_procinfo.procdef.returndef)) then
|
||||||
begin
|
begin
|
||||||
Message(parser_e_void_function);
|
Message(parser_e_void_function);
|
||||||
|
45
tests/webtbs/tw16803.pp
Normal file
45
tests/webtbs/tw16803.pp
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
{ %opt=-g-h }
|
||||||
|
|
||||||
|
{$ifdef fpc}
|
||||||
|
{$mode delphi}
|
||||||
|
{$endif}
|
||||||
|
|
||||||
|
uses
|
||||||
|
sysutils;
|
||||||
|
|
||||||
|
function test1: longint;
|
||||||
|
begin
|
||||||
|
try
|
||||||
|
try
|
||||||
|
result:=1;
|
||||||
|
raise exception.create('1');
|
||||||
|
except
|
||||||
|
exit(2);
|
||||||
|
end;
|
||||||
|
except
|
||||||
|
exit(3);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function test2: ansistring;
|
||||||
|
begin
|
||||||
|
result:='a';
|
||||||
|
try
|
||||||
|
try
|
||||||
|
result:=result+'b';
|
||||||
|
raise exception.create('2');
|
||||||
|
except
|
||||||
|
result:=result+'c';
|
||||||
|
end;
|
||||||
|
except
|
||||||
|
result:=result+'d';
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
HaltOnNotReleased:=true;
|
||||||
|
if test1<>2 then
|
||||||
|
halt(1);
|
||||||
|
if test2<>'abc' then
|
||||||
|
halt(2)
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user