[fpc-pascal] compiler last sources Internal error on code including generic and anonymous function
Hello, from time to time I recompile fpc and lazarus from latest sources. After today's recompilation compiler cannot translate construction, what was possible to translate couple of months ago(linux 64b). Compiler gives internal error 2011010304 on line 96. When there is not assignment to Result in anonymous function, it compiles just fine. Did I miss something or is it worth report bug? Attached file is just an example to simulate the problem. regards, Tomas compproblem.lpr Description: Binary data ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Illegal expression when redeclare typed constant
Zamrony P. Juhara via fpc-pascal schrieb am So., 26. März 2023, 00:05: > Suppose I have > > unit mytest; > > interface > > const > MY_VALUE = 1; > MY_INT_VALUE: integer = 1; > > implementation > end. > > and second unit > > unit mytest2; > > interface > > uses mytest; > > const > // this is legal > MY_VALUE = mytest.MY_VALUE; > > // this causes illegal expression > // MY_INT_VALUE = mytest.MY_INT_VALUE; > // MY_INT_VALUE : integer = mytest.MY_INT_VALUE; > > implementation > end. > > > Is there workaround to redeclare typed constant in other unit so that I > don't need to duplicate code? > Typed constants are essentially variables and you can't redeclare variables. Only way you might do that (which I do not recommend because it opens it's own can of worms) is to declare the original variable as "public" and to import it in the other unit using "external". Regards, Sven > ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal