[Issue 23947] If a class overloads a method mixing private and public and the last overload is public, the method is always public.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue May 30 14:48:29 UTC 2023


https://issues.dlang.org/show_bug.cgi?id=23947

--- Comment #1 from FeepingCreature <default_357-line at 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) { }
}

--


More information about the Digitalmars-d-bugs mailing list