[fpc-pascal] try except end cannot handle Exception class name with "." Fatal: Syntax error, "DO" expected but "." found

Dennis dec12 at avidsoft.com.hk
Fri Jan 8 04:53:42 CET 2016


I am using FPC 2.6.4

   TMyClass =class
   public
     type
        EMyException=class(Exception);
     procedure DoSomething;
   end;


procedure SomeProc;
var aObj : TMyClass;
begin

   try
     aObj := TMyClass.Create;
     aObj.DoSomething;
   except
     On E : TMyClass.EMyException do begin// this will raise Fatal: 
Syntax error, "DO" expected but "." found
          //some handling
     end;
   end;

end;

//but the following complies ok

procedure SomeProc;
var aObj : TMyClass;
begin
   With TMyClass do
   try
     aObj := TMyClass.Create;
     aObj.DoSomething;
   except
     On E : EMyException do begin
          //some handling
     end;
   end;
end;

Is this problem solved in FPC 3.0?

Dennis


More information about the fpc-pascal mailing list