This code:

{$mode objfpc}{$H+}

type
  generic TType1<A,B> = class end;
  generic TType2  = specialize TType1<A,String>;

begin
end.

fails:
x.pas(5,42) Error: Identifier not found "A"
x.pas(5,42) Error: Type identifier expected
x.pas(5,50) Error: Illegal expression
x.pas(7,1) Error: This type can't be a generic

but this code:

{$mode objfpc}{$H+}

type
  generic TType1<A,B> = class end;
  generic TType2  = class(specialize TType1<A,String>) end;

begin
end.

works. Does it have to be like the 2nd code for partial generic
specialization?



--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Correct-way-for-partial-generic-specialization-tp5714160.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to