Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2016-01

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

3 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Dennis

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

Sven Barth
to Dennis
"Dennis" wrote
Is this problem solved in FPC 3.0?

Why don't you simply test it? FPC 3.0 is already released after all. And if it doesn't work then it would be best if you report a bug :)

Regards,
Sven

Graeme Geldenhuys
to Dennis: I am using FPC 2.6.4 TMyClass =class public type EMyException=class(Exception); procedure…
Dennis wrote
Is this problem solved in FPC 3.0?

As Sven said, why not test with 3.0 it is released already and quick to install. Anyway I tested with FPC 3.0 and it compiles just fine and the running program behaves as it should.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp