Forum > FPC development
Possible bug related to not interfacing overloaded functions
(1/1)
440bx:
Hello,
When an overloaded function is interfaced, the compiler apparently considers all the overloads to be interfaced even if they are not explicitly and individually interfaced.
For instance, if you have two functions in a unit such as:
--- 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";}};} --- function Overloaded(constref parm1 : somerecord; const parm2 : dword; const parm3 : dword; const parm4 : dword) : boolean; and function Overloaded(constref parm1 : astruct; constref parm2 : astruct2) : boolean;
Declaring the first one in the interface section makes the additional overload also callable from outside the unit (that is not desirable.)
See attached for a complete, runnable, example.
ASerge:
--- Quote from: 440bx on December 09, 2018, 05:48:40 pm ---When an overloaded function is interfaced, the compiler apparently considers all the overloads to be interfaced even if they are not explicitly and individually interfaced.
--- End quote ---
In the trunk version 3.3.1 already works correctly - compile time error.
440bx:
--- Quote from: ASerge on December 09, 2018, 06:13:21 pm ---In the trunk version 3.3.1 already works correctly - compile time error.
--- End quote ---
Thank you Serge. Nice to know it has already been fixed. I'm looking forward to the next stable release. :)
I should remember to always mention the compiler version. Maybe version 3.3.1 of my brain will remember these things.
Navigation
[0] Message Index