Recent

Author Topic: Possible bug related to not interfacing overloaded functions  (Read 1580 times)

440bx

  • Hero Member
  • *****
  • Posts: 1995
Possible bug related to not interfacing overloaded functions
« on: December 09, 2018, 05:48:40 pm »
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  [Select][+][-]
  1.  
  2. function Overloaded(constref parm1 : somerecord;
  3.                     const    parm2 : dword;
  4.                     const    parm3 : dword;
  5.                     const    parm4 : dword) : boolean;
  6.  
  7. and
  8.  
  9.  
  10. function Overloaded(constref parm1 : astruct;
  11.                     constref parm2 : astruct2) : boolean;
  12.  

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.
FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 64bit.

ASerge

  • Hero Member
  • *****
  • Posts: 1671
Re: Possible bug related to not interfacing overloaded functions
« Reply #1 on: December 09, 2018, 06:13:21 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.
In the trunk version 3.3.1 already works correctly - compile time error.

440bx

  • Hero Member
  • *****
  • Posts: 1995
Re: Possible bug related to not interfacing overloaded functions
« Reply #2 on: December 09, 2018, 06:31:09 pm »
In the trunk version 3.3.1 already works correctly - compile time error.
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. 
FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 64bit.

 

TinyPortal © 2005-2018