You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CWG3166 [expr.reflect] Clarify whether the protected access rule for a pointer-to-member applies to a reflect-expression #852
Issue description: It is not clear whether the following is valid:
class A {
protected:
void f();
};
struct B : A {
static constexpr auto r = ^^A::f;
};
According to [expr.reflect]/7.2, "overload resolution for the expression" &A::f "with no target shall select a unique function". Do the restrictions in [class.protected] on the use of the expression &A::f apply to the reflect-expression?
Suggested resolution (by Brian): Edit [expr.reflect]/7.2 as follows:
Otherwise, if the id-expression denotes an overload set S, overload resolution for the expression &S with no target shall select a unique function ([over.over])the expression &id-expression shall be well-formed when considered as an unevaluated operand; R represents thatthe function selected by overload resolution ([over.over]).
changed the title [-][expr.reflect] Clarify whether the protected access rule for a pointer-to-member applies to a reflect-expression[/-][+]CWG3166 [expr.reflect] Clarify whether the protected access rule for a pointer-to-member applies to a reflect-expression[/+]on Mar 11, 2026
Following up on the discussion from the most recent telecon.
We should change [expr.reflect]/7.2 to avoid referring to overload resolution, because the process of resolving the "address of an overload set" as specified in [over.over] is, technically, not a form of overload resolution. See [over.match.general].
Originally, I thought the choice was between changing [expr.reflect] and [class.protected]. But the former needs changes no matter what wording strategy we choose, so I continue to think that we shouldn't edit [class.protected]. We should just make it clear that the deletedness check doesn't apply. Here's the updated edit for [expr.reflect]/7.2:
Otherwise, if the id-expression denotes an overload set S, overload resolution for the expression &S with no target shall select a unique function ([over.over])the expression &id-expression shall be well-formed when considered as an unevaluated operand, except that the function F selected as described in [over.over] may be deleted ([dcl.fct.def.delete]); R represents thatF.
Activity
jensmaurer commentedon Mar 11, 2026
CWG3166
[-][expr.reflect] Clarify whether the protected access rule for a pointer-to-member applies to a reflect-expression[/-][+]CWG3166 [expr.reflect] Clarify whether the protected access rule for a pointer-to-member applies to a reflect-expression[/+]timsong-cpp commentedon Mar 11, 2026
Does that wording block taking a reflection of a deleted function?
t3nsor commentedon Mar 11, 2026
Yeah, I guess it does. I forgot that we had a special rule to support that.
t3nsor commentedon May 12, 2026
Following up on the discussion from the most recent telecon.
We should change [expr.reflect]/7.2 to avoid referring to overload resolution, because the process of resolving the "address of an overload set" as specified in [over.over] is, technically, not a form of overload resolution. See [over.match.general].
Originally, I thought the choice was between changing [expr.reflect] and [class.protected]. But the former needs changes no matter what wording strategy we choose, so I continue to think that we shouldn't edit [class.protected]. We should just make it clear that the deletedness check doesn't apply. Here's the updated edit for [expr.reflect]/7.2:
jensmaurer commentedon May 14, 2026
Updated: CWG3166