Browse Source

* don't throw an internal error if a procedure is passed to a const formal parameter, resolves #40817

florian 1 year ago
parent
commit
8b2ebd07bf
2 changed files with 13 additions and 1 deletions
  1. 1 1
      compiler/htypechk.pas
  2. 12 0
      tests/webtbf/tw40817.pp

+ 1 - 1
compiler/htypechk.pas

@@ -1828,7 +1828,7 @@ implementation
              blockn,
              calln :
                begin
-                 if (hp.nodetype=calln) or
+                 if ((hp.nodetype=calln) and not(is_void(hp.resultdef))) or
                     (nf_no_lvalue in hp.flags) then
                    begin
                      { Temp strings are stored in memory, for compatibility with

+ 12 - 0
tests/webtbf/tw40817.pp

@@ -0,0 +1,12 @@
+{ %fail ]
+procedure proc;
+begin
+end;
+
+procedure test(const o);
+begin
+end;
+
+begin
+  test(proc); // project1.lpr(10,3) Error: Internal error 2011010304
+end.