Skip to content

[expr.reflect] Clarify whether the protected access rule for a pointer-to-member applies to a reflect-expression #852

@t3nsor

Description

@t3nsor

Full name of submitter: Aurelien Cassagnes

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 that the function selected by overload resolution ([over.over]).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions