[fpc-pascal] Generics Compile Error, 2.4.2 vs 2.6.0

David Copeland david.copeland at jsidata.ca
Mon Feb 13 17:31:58 CET 2012


Under FPC 2.4.2 I have been using RBTree unit that uses generics. With
2.6.0 it fails to compile. I know that there have been changes for 2.6.0
but I have checked the syntax in the 2.6.0 Language Reference and cannot
see why the error is occurring. I have also looked in Mantis but don't
know if anything there relates to my problem. I have excerpted the code
below and attached the complete unit.

==================

unit FOS_REDBLACKTREE_GEN;

// (c) Copyright FirmOS Business Solutions GmbH
// Author Helmut Hartl, Franz Schober

}
//{$MODE OBJFPC}
{$MODE DELPHI}
{$H+}

interface

type
  TRB_NodeColor=(R,B);

  { TGFOS_RBTree }
  {$B-}
  generic TGFOS_RBTree<_TKey,_TStore> = class(TInterfacedObject)

*** The error occurs at the line above.

Free Pascal Compiler version 2.6.0 [2012/02/08] for x86_64
Copyright (c) 1993-2011 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling FOS_REDBLACKTREE_GEN.pas
FOS_REDBLACKTREE_GEN.pas(48,11) Fatal: Syntax error, "=" expected but
"identifier TGFOS_RBTREE" found
Fatal: Compilation aborted


    type public
      PFOS_RB_NodeG=^TFOS_RB_NodeG;
      _PStore       =^_TStore;
      TFOS_RB_NodeG = packed record
          k:  _TKey;
          left, right, parent: PFOS_RB_NodeG;
          col: TRB_NodeColor;
          val:_TStore;
       end;
       TCompareKeys     = function  (const Item1, Item2: _TKey):
Integer;
       TGUndefined      = function  :_Tstore;
       TGUndefinedKey   = function  :_TKey;
       TGFOS_RB_OnItem  = procedure (const Item:_TStore) of object;
       TGFOS_RB_OnItemN = procedure (const Item:_TStore);


==================

Thanks for any help.

-- 
David Copeland
JSI Data Systems Limited
613-727-9353.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FOS_REDBLACKTREE_GEN.pas.zip
Type: application/zip
Size: 4763 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20120213/6071dbbc/attachment.zip>


More information about the fpc-pascal mailing list