mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-07 15:28:08 +02:00

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
31 lines
432 B
ObjectPascal
31 lines
432 B
ObjectPascal
{$Mode ObjFPC}{$H+}
|
|
|
|
type
|
|
TBase = class
|
|
public
|
|
function Foo:Integer;virtual;abstract;
|
|
end;
|
|
|
|
generic TTest<T:class> = class(T)
|
|
public
|
|
end;
|
|
|
|
generic TTest2<T:class> = class(specialize TTest<T>)
|
|
public
|
|
function Foo:Integer;override;
|
|
end;
|
|
|
|
function TTest2.Foo:Integer;
|
|
begin
|
|
Result:=42;
|
|
end;
|
|
|
|
var
|
|
b: TBase;
|
|
begin
|
|
b:=specialize TTest2<TBase>.Create;
|
|
if b.Foo<>42 then
|
|
Halt(1);
|
|
WriteLn('Ok');
|
|
end.
|