Why is this an issue?

Nested routines cannot be used as procedural values.

This will normally cause a compilation error, but such errors can be bypassed by using the address of the nested routine with @.

In this scenario, the code generated by compiler will have undefined behavior.

How to fix it

Do not use @ to get the address of a nested routine. If a method pointer is required, convert the nested routine into a top-level routine.

Resources