View Issue Details

IDProjectCategoryView StatusLast Update
0019535FPCCompilerpublic2016-10-21 11:04
ReporterBasil PeaceAssigned To 
PrioritynormalSeverityminorReproducibilityalways
Status acknowledgedResolutionopen 
Product VersionProduct Build 
Target VersionFixed in Version 
Summary0019535: Cannot use generic based on other generic
DescriptionThe following code can't be compiled neither in DELPHI mode nor in objfpc mode (with 'generic' and 'specialize' added):

  TGeneric1<T1> = class
    function Sample: T1;
  end;
  
  TGeneric2<T1> = class(TGeneric1<TGeneric1<T1>>)
    function Sample2: T1;
  end;

The error is in TGeneric2's line:
Fatal: Syntax error, ">" expected but "<" found.

P.S. Version from trunk
Tagsgenerics
Fixed in Revision
FPCOldBugId
FPCTarget
Attached Files

Relationships

related to 0024283 new Generics syntax error, ">" expected but "<" found 

Activities

Sven Barth

2012-02-04 17:42

manager   ~0056474

At least the following works already:

In mode Delphi:

TGeneric2<T1> = class(TGeneric1<T1>)

In mode ObjFPC:

TGeneric2<T1> = class(specialize TGeneric1<T1>)

The nested variants don't work yet.

Regards,
Sven

silvioprog

2016-08-19 17:50

reporter   ~0094195

Last edited: 2016-08-19 17:53

View 5 revisions

The following code compiles fine in latest trunk version:

Please open this link, mantis unfortunately broke my code: http://pastebin.com/FwkknZWE.

So, is this bug solved?

Jan Bruns

2016-10-21 11:04

reporter   ~0095245

{$mode objfpc}

type
Tbase1 = class
end;

type
generic Textender1<_T> = class(_T)
end;

Tmycl = specialize Textender1<Tbase1>;


begin
end.

{ fpc 3.0.0 [2015/12/05]:
  Error: class type expected, but got "<undefined type>"
}

Issue History

Date Modified Username Field Change
2011-06-10 02:53 Basil Peace New Issue
2011-06-10 02:54 Basil Peace Tag Attached: generics
2012-02-04 17:42 Sven Barth Note Added: 0056474
2012-06-14 18:00 Sven Barth Status new => acknowledged
2016-08-19 17:50 silvioprog Note Added: 0094195
2016-08-19 17:51 silvioprog Note Edited: 0094195 View Revisions
2016-08-19 17:51 silvioprog Note Edited: 0094195 View Revisions
2016-08-19 17:52 silvioprog Note Edited: 0094195 View Revisions
2016-08-19 17:53 silvioprog Note Edited: 0094195 View Revisions
2016-08-22 19:57 Sven Barth Relationship added related to 0024283
2016-10-21 11:04 Jan Bruns Note Added: 0095245