Contrary to popular believe the VMT for a generic needs to be at least generated so that check for inherited methods can be done correctly. This does however not mean that the VMT is written to the object file which is handled at a completely different place. Fixes Mantis #26193.

pdecl.pas, types_dec:
  * invoke the VMT builder for generic classes as well

+ added test

git-svn-id: trunk@27869 -
This commit is contained in:
svenbarth 2014-06-06 13:05:39 +00:00
parent 79d2abd1ca
commit 9ab5affd55
3 changed files with 25 additions and 2 deletions

1
.gitattributes vendored
View File

@ -12747,6 +12747,7 @@ tests/webtbf/tw25861.pp svneol=native#text/plain
tests/webtbf/tw25862.pp svneol=native#text/plain tests/webtbf/tw25862.pp svneol=native#text/plain
tests/webtbf/tw25915.pp svneol=native#text/pascal tests/webtbf/tw25915.pp svneol=native#text/pascal
tests/webtbf/tw25951.pp svneol=native#text/pascal tests/webtbf/tw25951.pp svneol=native#text/pascal
tests/webtbf/tw26193.pp svneol=native#text/pascal
tests/webtbf/tw2657.pp svneol=native#text/plain tests/webtbf/tw2657.pp svneol=native#text/plain
tests/webtbf/tw2670.pp svneol=native#text/plain tests/webtbf/tw2670.pp svneol=native#text/plain
tests/webtbf/tw2719.pp svneol=native#text/plain tests/webtbf/tw2719.pp svneol=native#text/plain

View File

@ -798,8 +798,7 @@ implementation
{ Build VMT indexes, skip for type renaming and forward classes } { Build VMT indexes, skip for type renaming and forward classes }
if (hdef.typesym=newtype) and if (hdef.typesym=newtype) and
not(oo_is_forward in tobjectdef(hdef).objectoptions) and not(oo_is_forward in tobjectdef(hdef).objectoptions) then
not(df_generic in hdef.defoptions) then
begin begin
vmtbuilder:=TVMTBuilder.Create(tobjectdef(hdef)); vmtbuilder:=TVMTBuilder.Create(tobjectdef(hdef));
vmtbuilder.generate_vmt; vmtbuilder.generate_vmt;

23
tests/webtbf/tw26193.pp Normal file
View File

@ -0,0 +1,23 @@
{ %FAIL }
program tw26193;
{$mode delphi}
type
TA<T> = class
function Foo: Boolean; virtual; abstract;
end;
TB<T> = class(TA<byte>)
// Missing (!) error: There is no method in an ancestor class to be overridden: "Foo;"
procedure Foo; override;
end;
procedure TB<T>.Foo;
begin
end;
begin
end.