Internal error on casting the closure to a function pointer.
While trying to build a simpler example for #40220 I got an `Internal error 2021060802` on the following code: ```pascal {$mode objfpc} {$modeswitch anonymousfunctions} procedure Main; var c: int32; begin c := 12; TProcedure(procedure begin writeln(c); end); end; begin Main; end. ``` (Yes the typecast is incorrect and the code would crash, but even compiling it without errors is probably better than throwing an internal error. Ideally, it should throw a descriptive compilation error.)
issue