C++ Logo

std-proposals

Advanced search

This deduction and access control

From: Magnus Fromreide <magfr_at_[hidden]>
Date: Sun, 19 Jul 2020 06:33:11 +0200
Hello!

I read P0847R4 and got curious about an edge case.

Consider

struct Base
{
        int i = 0;

        template <class Self>
        auto& f(this Self&& self)
        {
                return forward<Self>(self).i;
        }
};

struct Derived: private Base
{
        using Base::f;
};

Now, as I am reading the proposal the call

Derived().f()

should be ill-formed as it tries to access Derived.i but that is private in
this context, or does the proposal change the access rules somehow?

/MF

Received on 2020-07-18 23:36:34