From dd3d0ae5bcc840a24bd4ee035fc7b4dc90df6e96 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Sun, 31 May 2015 16:51:02 +0000 Subject: [PATCH] * set the type of the hidden $vmt parameter to the correct classrefdef and adjust the parameter comparison code to ignore types of $vmt parameters when comparing (previously they were all voidpointer and hence also equal) git-svn-id: trunk@30955 - --- compiler/defcmp.pas | 9 ++++++--- compiler/nld.pas | 5 ----- compiler/pparautl.pas | 4 +--- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/compiler/defcmp.pas b/compiler/defcmp.pas index 289354cfbe..26ea3de9cb 100644 --- a/compiler/defcmp.pas +++ b/compiler/defcmp.pas @@ -2010,15 +2010,18 @@ implementation if (vo_is_hidden_para in currpara1.varoptions)<>(vo_is_hidden_para in currpara2.varoptions) then exit; eq:=te_exact; - if not(vo_is_self in currpara1.varoptions) and - not(vo_is_self in currpara2.varoptions) then + if (([vo_is_self,vo_is_vmt]*currpara1.varoptions)=[]) and + (([vo_is_self,vo_is_vmt]*currpara2.varoptions)=[]) then begin if not(cpo_ignorevarspez in cpoptions) and (currpara1.varspez<>currpara2.varspez) then exit; eq:=compare_defs_ext(currpara1.vardef,currpara2.vardef,nothingn, convtype,hpd,cdoptions); - end; + end + else if ([vo_is_self,vo_is_vmt]*currpara1.varoptions)<> + ([vo_is_self,vo_is_vmt]*currpara2.varoptions) then + eq:=te_incompatible; end else begin diff --git a/compiler/nld.pas b/compiler/nld.pas index a0519f32f6..f20714e82e 100644 --- a/compiler/nld.pas +++ b/compiler/nld.pas @@ -346,11 +346,6 @@ implementation (po_classmethod in tprocdef(symtableentry.owner.defowner).procoptions) then resultdef:=cclassrefdef.create(tprocdef(symtableentry.owner.defowner).struct) end - else if vo_is_vmt in tabstractvarsym(symtableentry).varoptions then - begin - resultdef:=tprocdef(symtableentry.owner.defowner).struct; - resultdef:=cclassrefdef.create(resultdef); - end; end; procsym : begin diff --git a/compiler/pparautl.pas b/compiler/pparautl.pas index cc57470420..5b62f2da67 100644 --- a/compiler/pparautl.pas +++ b/compiler/pparautl.pas @@ -225,9 +225,7 @@ implementation (tobjectdef(tprocdef(pd).struct).extendeddef.typ<>objectdef) )) then begin - { can't use classrefdef as type because inheriting - will then always file because of a type mismatch } - vs:=cparavarsym.create('$vmt',paranr_vmt,vs_value,voidpointertype,[vo_is_vmt,vo_is_hidden_para]); + vs:=cparavarsym.create('$vmt',paranr_vmt,vs_value,cclassrefdef.create(tprocdef(pd).struct),[vo_is_vmt,vo_is_hidden_para]); pd.parast.insert(vs); end;