Browse Source

* don't give an error when calling a class method on an object typecasted
into a class reference (problem introduced by r23976)

git-svn-id: trunk@24039 -

Jonas Maebe 12 years ago
parent
commit
9973a5737f
1 changed files with 5 additions and 2 deletions
  1. 5 2
      compiler/ncal.pas

+ 5 - 2
compiler/ncal.pas

@@ -3150,8 +3150,6 @@ implementation
                 hpt:=methodpointer;
                 while assigned(hpt) and (hpt.nodetype in [subscriptn,vecn]) do
                   hpt:=tunarynode(hpt).left;
-                { skip (absolute and other simple) type conversions }
-                hpt:=hpt.actualtargetnode;
 
                 if ((hpt.nodetype=loadvmtaddrn) or
                    ((hpt.nodetype=loadn) and assigned(tloadnode(hpt).resultdef) and (tloadnode(hpt).resultdef.typ=classrefdef))) and
@@ -3167,6 +3165,11 @@ implementation
                   (tnode(twithsymtable(symtableproc).withrefnode).nodetype=temprefn) then
                  CGmessage(cg_e_cannot_call_cons_dest_inside_with);
 
+               { skip (absolute and other simple) type conversions -- only now,
+                 because the checks above have to take type conversions into
+                 e.g. class reference types account }
+               hpt:=hpt.actualtargetnode;
+
                { R.Init then R will be initialized by the constructor,
                  Also allow it for simple loads }
                if (procdefinition.proctypeoption=potype_constructor) or