Thread overview
[Issue 24388] Private overload of public function can be called from other modules
Feb 12
RazvanN
Feb 12
RazvanN
February 11
https://issues.dlang.org/show_bug.cgi?id=24388

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ibuclaw@gdcproject.org

--- Comment #1 from Iain Buclaw <ibuclaw@gdcproject.org> ---
Looks to be a duplicate of issue 3254.

--
February 11
https://issues.dlang.org/show_bug.cgi?id=24388

--- Comment #2 from Paul Backus <snarwin+bugzilla@gmail.com> ---
It's not the same bug as the original report in 3254 (that one is order-dependent, this one isn't). However, it looks like 3254 has been repurposed since its reopening in 2022 to refer to the bug described here, since other issues that are exact duplicates of this one have been marked as duplicates of 3254.

--
February 12
https://issues.dlang.org/show_bug.cgi?id=24388

RazvanN <razvan.nitu1305@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |razvan.nitu1305@gmail.com

--- Comment #3 from RazvanN <razvan.nitu1305@gmail.com> ---
@Paul, initially, the issue was that you could call the private overload if the public one was the first in the overload set. Then some "progress" has been made by getting rid of the order dependency, however, the issue of being able to call the private overload remains (that is why the issue was reopened). To me, it looks like the original bug which caused 3254 was not fixed properly, therefore it makes sense to keep that original one open and mark this one as a duplicate.

--
February 12
https://issues.dlang.org/show_bug.cgi?id=24388

--- Comment #4 from RazvanN <razvan.nitu1305@gmail.com> ---
Also, I tried to fix this in the past, however, the issue is that private functions that are part of an overload set can be called from templated functions if they are passed via an alias template parameter. Some people argue that this is a valid use case because a single private function can be called from a templated function that way. For more info on this discussion see: https://github.com/dlang/dmd/pull/13257

--
February 12
https://issues.dlang.org/show_bug.cgi?id=24388

Paul Backus <snarwin+bugzilla@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #5 from Paul Backus <snarwin+bugzilla@gmail.com> ---
As a general rule, I don't think that "the attempted fix for bug X ended up causing bug Y" is a good reason to consider Y a duplicate of X. But since the decision to do so has already been made in this case, I'm fine going along with it here.

*** This issue has been marked as a duplicate of issue 3254 ***

--