Thread overview
[Issue 23947] If a class overloads a method mixing private and public and the last overload is public, the method is always public.
May 30, 2023
FeepingCreature
May 30, 2023
FeepingCreature
May 30, 2023
Dlang Bot
Jun 13, 2023
Dlang Bot
Jun 14, 2023
Vladimir Panteleev
Jun 16, 2023
Dlang Bot
May 30, 2023
https://issues.dlang.org/show_bug.cgi?id=23947

FeepingCreature <default_357-line@yahoo.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid, industry

--
May 30, 2023
https://issues.dlang.org/show_bug.cgi?id=23947

--- Comment #1 from FeepingCreature <default_357-line@yahoo.de> ---
Correction: more testing suggests that the accepts-invalid condition is "the method is private, but a method defined after it in the overload set is public". Doesn't have to be the last one.

Consider: this compiles.

--- b.d
struct X { }
struct Y { }
struct Z { }
class Class {
    private void handle(X x) { }
    public void handle(Y y) { }
    private void handle(Z z) { }
}

--
May 30, 2023
https://issues.dlang.org/show_bug.cgi?id=23947

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #2 from Dlang Bot <dlang-bot@dlang.rocks> ---
@FeepingCreature updated dlang/dmd pull request #15282 "Fix issue 23974: Class method private is ignored if there's a public overload after it" fixing this issue:

- Fix issue 23947: If checking access after overload resolution, only check the
specific overload selected, not the most public overload of the set.
  This is a deprecation because making it an error would force issue 21275 to
be an error as well.

https://github.com/dlang/dmd/pull/15282

--
June 13, 2023
https://issues.dlang.org/show_bug.cgi?id=23947

Dlang Bot <dlang-bot@dlang.rocks> changed:

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

--- Comment #3 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #15282 "Fix issue 23947: Class method private is ignored if there's a public overload after it" was merged into master:

- 8feaf5262cf35aa48b26b5177c9c1db2790f341c by Mathis Beer:
  Fix issue 23947: If checking access after overload resolution, only check the
specific overload selected, not the most public overload of the set.
  This deprecation also covers the deprecation for issue 21275.
  This is a deprecation because making it an error would force issue 21275 to
be an error as well.

https://github.com/dlang/dmd/pull/15282

--
June 14, 2023
https://issues.dlang.org/show_bug.cgi?id=23947

Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dlang-bugzilla@thecybershad
                   |                            |ow.net

--- Comment #4 from Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> ---
*** Issue 23992 has been marked as a duplicate of this issue. ***

--
June 16, 2023
https://issues.dlang.org/show_bug.cgi?id=23947

--- Comment #5 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #15319 "Make 'private function is not accessible' deprecation an error." was merged into master:

- fd0ebb96e18d3fa54d53bfb71210da2ff9135463 by Mathis Beer:
  Make 'private function is not accessible' deprecation an error.
  Affects issue 21275, 23947.

https://github.com/dlang/dmd/pull/15319

--