On Tue, 31 Mar 2015, leledumbo wrote:

Consider the following program:

{$mode objfpc}

uses sysutils;

begin
 try
   try
     raise exception.create('test');
   except
     on e: exception do begin
       e.message := 'tset';
       raise e; // correct re-raise should only have raise; no exception
variable may present
     end;
   end;
 except
   writeln('oow');
 end;
end.

which is a wrong way to re-raise an exception. The program runs but after
the outer exception handler ('oow'), it ends with EAccessViolation. Is this
the intended behavior?

I tested in Delphi XE, it also crashes. So, yes it is intended behaviour.

It is not desirable, of course. But there is no way the compiler can decide whether the 'raise e' statement is correct.

Michael.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to