mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-05 12:38:29 +02:00
25 lines
509 B
Plaintext
25 lines
509 B
Plaintext
{ %NORUN }
|
|
|
|
{$MODE OBJFPC} { -*- text -*- }
|
|
program tw19511;
|
|
|
|
type
|
|
generic TFoo<X> = class
|
|
end;
|
|
generic TBar<Y> = class
|
|
type
|
|
TIntegerSpecializedFoo = specialize TFoo<Integer>;
|
|
TSelfSpecializedFoo = specialize TFoo<TBar>;
|
|
function SelfTest(): TBar; // returns a TBar<Y>
|
|
TSpecializedBar = specialize TBar<Y>; // this rightly would not compile since TBar here refers to the specialized TBar<Y>
|
|
end;
|
|
|
|
function TBar.SelfTest(): TBar;
|
|
begin
|
|
Result := Self;
|
|
end;
|
|
|
|
begin
|
|
end.
|
|
|