From 9ab5affd55be82f77f0eff1723a0dfb8ea6f8100 Mon Sep 17 00:00:00 2001 From: svenbarth Date: Fri, 6 Jun 2014 13:05:39 +0000 Subject: [PATCH] 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 - --- .gitattributes | 1 + compiler/pdecl.pas | 3 +-- tests/webtbf/tw26193.pp | 23 +++++++++++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 tests/webtbf/tw26193.pp diff --git a/.gitattributes b/.gitattributes index 84ee4a30e2..86f88e3497 100644 --- a/.gitattributes +++ b/.gitattributes @@ -12747,6 +12747,7 @@ tests/webtbf/tw25861.pp svneol=native#text/plain tests/webtbf/tw25862.pp svneol=native#text/plain tests/webtbf/tw25915.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/tw2670.pp svneol=native#text/plain tests/webtbf/tw2719.pp svneol=native#text/plain diff --git a/compiler/pdecl.pas b/compiler/pdecl.pas index 96cf6d6ffc..a7ff1cee1a 100644 --- a/compiler/pdecl.pas +++ b/compiler/pdecl.pas @@ -798,8 +798,7 @@ implementation { Build VMT indexes, skip for type renaming and forward classes } if (hdef.typesym=newtype) and - not(oo_is_forward in tobjectdef(hdef).objectoptions) and - not(df_generic in hdef.defoptions) then + not(oo_is_forward in tobjectdef(hdef).objectoptions) then begin vmtbuilder:=TVMTBuilder.Create(tobjectdef(hdef)); vmtbuilder.generate_vmt; diff --git a/tests/webtbf/tw26193.pp b/tests/webtbf/tw26193.pp new file mode 100644 index 0000000000..1d5b35b495 --- /dev/null +++ b/tests/webtbf/tw26193.pp @@ -0,0 +1,23 @@ +{ %FAIL } + +program tw26193; + +{$mode delphi} + +type + TA = class + function Foo: Boolean; virtual; abstract; + end; + + TB = class(TA) + // Missing (!) error: There is no method in an ancestor class to be overridden: "Foo;" + procedure Foo; override; + end; + +procedure TB.Foo; +begin +end; + +begin +end. +