Forum > General
Internal Error with Generic Nested Routines
simone:
As is known, starting from version 3.2.0 FPC supports generic free-standing (i.e. standing out of a type declaration) procedures / functions. Since this new feature is documented only here: https://wiki.freepascal.org/FPC_New_Features_3.2.0#Support_for_Generic_Routines, no mention in the language reference guide, I did some experiments to better understand benefits and limitations.
I found that the following program in FPC 3.2.0 generates an internal error (always, not randomly):
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---program Project1;{$mode ObjFPC} procedure AddGroup; generic procedure Add<T>(const X : T; const Y : T; out Z : T); begin Z:=X+Y; end; var R : integer; begin specialize Add<integer>(4,5,R); end; begin AddGroup;end.
Compiler Output:
C:\Users\simon\AppData\Local\Temp\project1.lpr(16,6) Fatal: Internal error 200511152
I don't know if generic nested procedures / functions are supported. If not, I would still expect a syntax error, not an internal error. What do you think?
Bart:
Same with fpc trunk r49116.
Maybe file a bugreport (and attach the sample project).
I could not find an existing bugreport about IE 200511152 in the bugtracker.
Bart
simone:
Thanks Bart for confirming. I have opened a bug report.
PascalDragon:
--- Quote from: simone on June 05, 2021, 09:34:40 pm ---I don't know if generic nested procedures / functions are supported. If not, I would still expect a syntax error, not an internal error. What do you think?
--- End quote ---
I mostly tested global routines and methods when I developed them, so better stick to those till the bug you reported is fixed. And you might also want to file a bug regarding the missing documentation of them in the language reference guide.
simone:
Already done in the past: https://bugs.freepascal.org/view.php?id=37256, but this feature is not yet documented in the language reference guide.
Navigation
[0] Message Index
[#] Next page