Hello all,

I am trying to use generics but compilation fails.
Whan I try to use unit with my generic class in my real project I get "Fatal: Internal error 200204175" error.
When I try to use it in empty Lazarus application (Unit1.pas) and I put
-----
procedure TForm1.Button1Click(Sender: TObject);
var
 lst:  specialize TTwoValuesList<UnicodeString>;
begin
end;
-----
I get these errors:
-----
Unit1.pas(29,17) Error: Forward declaration not solved "constructor TTwoValuesList$UnicodeString.Create;" Unit1.pas(30,16) Error: Forward declaration not solved "destructor TTwoValuesList$UnicodeString.Destroy;" Unit1.pas(32,15) Error: Forward declaration not solved "TTwoValuesList$UnicodeString.AddString(UnicodeString,UnicodeString);" Unit1.pas(33,14) Error: Forward declaration not solved "TTwoValuesList$UnicodeString.GetS1(LongInt):UnicodeString;" Unit1.pas(34,14) Error: Forward declaration not solved "TTwoValuesList$UnicodeString.GetS2(LongInt):UnicodeString;" Unit1.pas(35,14) Error: Forward declaration not solved "TTwoValuesList$UnicodeString.Count:LongInt;" Unit1.pas(36,14) Error: Forward declaration not solved "TTwoValuesList$UnicodeString.GetS2(UnicodeString,Boolean="FALSE"):UnicodeString;"
Unit1.pas(47) Fatal: There were 7 errors compiling module, stopping
-----

my generic class is in another (not Unit1.pas) unit looks like this:
-----
type
 generic TTwoValuesList<TVal> = class
 type private
   PTwoVal = ^TTwoVal;
   TTwoval = record
     FS1: TVal;
     FS2: TVal;
   end;

 var private
   FLst: TFPList;

 public
   constructor Create;
   destructor Destroy;

   procedure AddString(S1: TVal; S2: TVal);
   function GetS1(i: Integer): TVal;
   function GetS2(i: Integer): TVal; overload;
   function Count: Integer;
   function GetS2(S1: TVal; isSorted: Boolean = false): TVal; overload;

 published
   property Items: TFPList read FLst;

 end;
-----

What am I doing wrong?


Regards,
Zilvinas Ledas
_______________________________________________
fpc-devel maillist  -  [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to