Skip to content

Code in derived class is allowed to access a base private non instance function when calls it unqualified #6239

@bricknerb

Description

@bricknerb

Description of the bug:

When a base class has non instanceprivate fn, its derived class can have a member function that calls it unqualified.
This access should be blocked.
When calling the base function in qualified way, this does result with the expected error.

What did you do, or what's a simple way to reproduce the bug?

Full example that should not compile, but does: https://godbolt.org/z/v3Pfo5sPG

Test:

What did you expect to happen?

Compilation error.

What actually happened?

The call to the private function is made.

Any other information, logs, or outputs that you want to share?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions