Sign in Join

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

Mailing lists / fpc-devel / 2010-09

Generics syntax error

6 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

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

Felipe Monteiro de Carvalho

Hello,

Has anyone experienced issues with generics? I have the following code:

unit cdescreen;
{$mode delphi}
interface
uses
  // LCL, RTL, FCL
  Classes, SysUtils, Controls, Graphics, LCLType, SDFData, fpimage,
  fgl,
  //
  cdeconfig, cdeprovinces, cdeutils, cdegame, cdetypes, dlgstatus;
type
  TCDEScreen = class;
  { TCDEDrawerDelegate }
  TCDEDrawerDelegate = class
  public
    Owner: TCDEScreen;
    procedure HandleMouseDown(Sender: TObject; Button: TMouseButton;
Shift:TShiftState; X,Y:Integer); virtual; abstract;
    procedure HandleMouseUp(Sender: TObject; Button: TMouseButton;
Shift:TShiftState; X,Y:Integer); virtual; abstract;
    procedure HandleMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer); virtual; abstract;
    procedure Prepare; virtual; abstract;
  end;
  TDrawerDelegateList = specialize TFPGList<TCDEDrawerDelegate>;
...
cdescreen.pas(29,63) Fatal: Syntax error, ";" expected but ">" found
If I change the line to   TDrawerDelegateList = specialize
TFPGList<TCDEDrawerDelegate;

then it says:

cdescreen.pas(29,63) Fatal: Syntax error, ">" expected but ";" found

o.O FPC 2.4.0 on Windows

I couldn't find anything in the bug tracker

Changing the mode to objfpc doesn't change anything

thanks,

Felipe Monteiro de Carvalho

Reply by email

Sven Barth
to Felipe Monteiro de Carvalho
Felipe Monteiro de Carvalho wrote 53 lines
Hello, Has anyone experienced issues with generics? I have the following code: unit cdescreen; {$mode delphi} interface uses // LCL, RTL, FCL Classes, SysUtils, Controls, Graphics, LCLType, SDFData, fpimage, fgl, // cdeconfig, cdeprovinces, cdeutils, cdegame, cdetypes, dlgstatus; type TCDEScreen = class; { TCDEDrawerDelegate } TCDEDrawerDelegate = class public Owner: TCDEScreen; procedure HandleMouseDown(Sender: TObject; Button: TMouseButton; Shift:TShiftState; X,Y:Integer); virtual; abstract; procedure HandleMouseUp(Sender: TObject; Button: TMouseButton; Shift:TShiftState; X,Y:Integer); virtual; abstract; procedure HandleMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); virtual; abstract; procedure Prepare; virtual; abstract; end; TDrawerDelegateList = specialize TFPGList<TCDEDrawerDelegate>; ... cdescreen.pas(29,63) Fatal: Syntax error, ";" expected but ">" found If I change the line to TDrawerDelegateList = specialize TFPGList<TCDEDrawerDelegate; then it says: cdescreen.pas(29,63) Fatal: Syntax error, ">" expected but ";" found o.O FPC 2.4.0 on Windows I couldn't find anything in the bug tracker Changing the mode to objfpc doesn't change anything thanks,

I'm having this issue, too, but with 2.4.3.

Regards,
Sven

Reply by email

Sven Barth
to Sven Barth
Sven Barth wrote
I'm having this issue, too, but with 2.4.3.

The following example code fails with FPC 2.4.2 RC1 as well (system is i386-win32):

====

program generictest;
{$mode objfpc}{$H+}
uses
   fgl;
type
   TTest = specialize TFPGList<TObject>;
begin
end.

====

2.4.0 works without problems here.
2.4.3 has the same problem (as mentioned in the previous mail).

Regards,
Sven

Reply by email

Willibald Krenn
to Sven Barth

Hi!

> I'm having this issue, too, but with 2.4.3. The following example code fails with FPC 2.4.2 RC1 as well (system is i386-win32):

Tried that with trunk and it compiled fine. (FPC 2.5 on win64)

Cheers,
Willi

Reply by email

Sven Barth
to Willibald Krenn
Willibald Krenn wrote 8 lines
Hi! >> I'm having this issue, too, but with 2.4.3. > > The following example code fails with FPC 2.4.2 RC1 as well (system is > i386-win32): Tried that with trunk and it compiled fine. (FPC 2.5 on win64)

I also tested with a 2.5.1 version from August (I don't remember the correct date currently) yesterday evening and it worked as well. (on i386-linux)

Regards,
Sven

Reply by email

Sven Barth
to Sven Barth
Sven Barth wrote 13 lines
Am 29.09.2010 00:54, schrieb Willibald Krenn: > Hi! > >>> I'm having this issue, too, but with 2.4.3. >> >> The following example code fails with FPC 2.4.2 RC1 as well (system is >> i386-win32): > > Tried that with trunk and it compiled fine. (FPC 2.5 on win64) I also tested with a 2.5.1 version from August (I don't remember the correct date currently) yesterday evening and it worked as well. (on i386-linux)

I looked around a bit more. There already exists a bug report from April for this: http://bugs.freepascal.org/view.php?id=16121

I manually merged 14176 to my 2.4.3 working copy now (as mentioned in the report) and I also needed to merge 14243 to resolve the remaining issues.

Regards,
Sven

Reply by email