fpc/tests/test/tgeneric114.pp
Frederic Kehrein 05b73f1523 Postponing building of VMT until inheritance chain is specialized
This commit does 3 changes:
1. Introduce new option `oo_inherits_not_specialized` indicating if
   somewhere in the inheritance chain of an object there is a non
   specialized generic parameter
2. Avoid building the VMT for an object which has a generic parameter in
   the inheritance chain (fixes #40983)
3. When no vmt is build `insert_struct_hidden_paras` usually called as
   part of `build_vmt` will be called seperately to add missing
   parameters
2024-12-08 17:54:50 +00:00

27 lines
325 B
ObjectPascal

{ %FAIL }
{$Mode ObjFPC}{$H+}
type
TBase = class
public
end;
generic TTest<T:class> = class(T)
public
function Foo:Integer;override;
end;
function TTest.Foo:Integer;
begin
Result:=42;
end;
var
b: TBase;
begin
b:=specialize TTest<TBase>.Create;
if b.Foo<>42 then
Halt(1);
WriteLn('Ok');
end.