Skip to content

Additional tests for {mode delphi} anonymous functions and function references. Current compiler fails on four of the tests.

Summary

Adding additional tanonfunc and tfuncref tests for {mode delphi}. We tried upgrading to trunk and the new anonymous and function ref capabilities. The result was compile errors in our code which we compile with {mode delphi}. We went through the existing tests and for the ones that were not objfpc specific we created new tests that are the same but can be compiled with {mode delphi} and with correct delphi syntax. Doing so we found a couple that failed in the same fashion we were seeing in our code. We also added one more test to cover all failure modes we saw in our code.DelphiModeAnonFuncRefTests.zip

System Information

  • Operating system: Macos, Linux, Windows
  • Processor architecture: x86_64, Aarch64
  • Compiler version: trunk
  • Device:

Steps to reproduce

run tanonfunc61.pp, tanonfunc62.pp, tanonfunc63.pp, and tanonfunc70.pp

Example Project

see attached tests

What is the current bug behavior?

Compile fails with one of these two messages:

Error: Wrong number of parameters specified for call to "<Procedure Variable>"

Error: Illegal type conversion: "untyped" to "^Pointer"

What is the expected (correct) behavior?

no errors

Relevant logs and/or screenshots

Possible fixes

Compile problem is when a function reference is called inside of an anonymous function with {mode delphi}. The original anonymous/funcref code that we had from Blaise did not fail with these tests. But we are seeing the failures for trunk FPC with Svens additions for anonymous functions and function references. We will not be able to drop our old Blaise code and sync up with trunk unless it is fixed. Thanks.

Edited by David Jenkins
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information