Browse Source

* don't see illegal calling conventions for procedure variables, resolves #41041

florian 7 months ago
parent
commit
3d6710c0e3
2 changed files with 16 additions and 0 deletions
  1. 4 0
      compiler/pdecsub.pas
  2. 12 0
      tests/webtbf/tw41041.pp

+ 4 - 0
compiler/pdecsub.pas

@@ -3290,6 +3290,10 @@ const
         if (pd_procvar in pdflags) and
            not(pd_procvar in proc_direcdata[p].pd_flags) then
           begin
+            { reset mismatching calling convention to avoid further errors, see e.g. tests/webtbf/tw41041.pp }
+            if proc_direcdata[p].pocall<>pocall_none then
+              pd.proccalloption:=pocall_default;
+
             MessagePos1(tokenloc, parser_e_proc_dir_not_allowed_in_procvar,name);
             exit;
           end;

+ 12 - 0
tests/webtbf/tw41041.pp

@@ -0,0 +1,12 @@
+{ %fail }
+program ie2017110102;
+
+type
+  tt = procedure; internproc;
+
+var
+  ff: tt;
+
+begin
+  ff; // project1.lpr(10,5) Error: Internal error 2017110102
+end.