Date: Sun, 19 Jul 2020 13:43:14 +0200
On Sun, Jul 19, 2020 at 07:02:22AM +0100, Gašper Ažman wrote:
> You are correct, it does not. You will have to mark the method as a friend
> in derived.
Ok, so under this proposal a using-declaration of a method from a parent
ain't enough to grant the use of it from a child.
I also noticed that this is very close to Universal Functions (N4165),
but slightly limited (can only be declared as members).
Do you foresee that this will evolve in the direction of allowing freely
declared deduced members?
Why is this not subject to the issues that stopped universal functions?
(I should probably, for the record, mention that I like the proposal even if
I sound rather critical)
/MF
> On Sun, Jul 19, 2020, 05:33 Magnus Fromreide <magfr_at_[hidden]> wrote:
>
> > 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
> >
> You are correct, it does not. You will have to mark the method as a friend
> in derived.
Ok, so under this proposal a using-declaration of a method from a parent
ain't enough to grant the use of it from a child.
I also noticed that this is very close to Universal Functions (N4165),
but slightly limited (can only be declared as members).
Do you foresee that this will evolve in the direction of allowing freely
declared deduced members?
Why is this not subject to the issues that stopped universal functions?
(I should probably, for the record, mention that I like the proposal even if
I sound rather critical)
/MF
> On Sun, Jul 19, 2020, 05:33 Magnus Fromreide <magfr_at_[hidden]> wrote:
>
> > 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-19 06:46:36