![]() |
Generics in FPC 2.6: Compiler bricht einfach ab
Nabend,
Hatte überlegt im weiteren verlauf der Entwicklung meines D16Pascal-SDKs zumindest den Compiler crossplattform als commandozeilentool zur verfügung zu stellen. Dafür dachte ich an FreePascal. Und weil ich jede menge Generics(Meist TObjectList<T>) benutze, wollte ich dem ganzen hier gleich mal auf den Zahn fühlen. Und da stellt sich der Compiler gerade als ser ungesprächig raus und rennt einfach heulend weg :D Folgender Source:
Delphi-Quellcode:
unit GenericTest;
{$MODE DELPHI} interface uses Classes, SysUtils; type { TFoo } TFoo<_T> = class private public procedure Test(); end; implementation { TFoo<_T> } procedure TFoo<_T>.Test; begin end; end.
Delphi-Quellcode:
Da bekomme ich nur "Main.pas(1,1): Compilation Aborted"
unit Main;
{$MODE DELPHI} {$H+} interface uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls; type { TForm1 } TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { private declarations } public { public declarations } end; var Form1: TForm1; implementation uses GenericTest; {$R *.lfm} { TForm1 } procedure TForm1.Button1Click(Sender: TObject); var LVar: TFoo<TObject>; begin end; end. Nehme ich die methode Test aus TFoo wieder raus compilierts. Das verstehe ich gerade nicht o.O |
AW: Generics in FPC 2.6: Compiler bricht einfach ab
Vielleicht hilft es wenn Du die () hinter dem Prozedurnamen entfernst?
|
AW: Generics in FPC 2.6: Compiler bricht einfach ab
Nein, bringt nichts
|
AW: Generics in FPC 2.6: Compiler bricht einfach ab
Hallo,
fehltba nicht das generic vor dem TFoo ? Heiko |
AW: Generics in FPC 2.6: Compiler bricht einfach ab
Zitat:
![]() Was in beiden Fällen auf jeden Fall noch nicht geht sind generische Methoden. Die stehen in den nächsten Wochen auf meiner Liste :) Gruß, Sven |
AW: Generics in FPC 2.6: Compiler bricht einfach ab
Delphi-Quellcode:
unit GenericTest;
{$MODE OBJFPC} interface uses Classes, SysUtils; type { TFoo } generic TFoo<_T> = class private public procedure Test(); end; implementation { TFoo<_T> } procedure TFoo.Test; begin end; end.
Delphi-Quellcode:
;)
unit Main;
{$MODE OBJFPC} {$H+} interface uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls; type { TForm1 } TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { private declarations } public { public declarations } end; var Form1: TForm1; implementation uses GenericTest; type TObjectFoo = specialize TFoo<TObject>; {$R *.lfm} { TForm1 } procedure TForm1.Button1Click(Sender: TObject); var LVar: TObjectFoo; begin end; end. |
AW: Generics in FPC 2.6: Compiler bricht einfach ab
Ah danke James. Muss 2.71 selbst compiliert wrden oder gibt es davon auch schon binaries?
EDIT: ah ok. Trunk-Snapshot zum selber backen schon gefunden^^ |
Alle Zeitangaben in WEZ +1. Es ist jetzt 23:28 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz