This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 117a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2025-05-12


3026. Class for pointer-to-member formation

Section: 7.6.2.2  [expr.unary.op]     Status: open     Submitter: Hubert Tong     Date: 2025-05-11

(From submission #705.)

Consider:

  struct A {
   union { int x; };
   int y;
  };
  struct B : A {};

  template <typename> struct Q;
  template <> struct Q<A> {};
  template <typename T> Q<T> f(int T::*);

  Q<A> g() { return f(&B::x); }  // OK
  Q<A> h() { return f(&B::y); }  // OK

For both cases, the pointer to member is of type "pointer to member of class A", but the wording is not clear.

Suggested resolution:

Change in 7.6.2.2 [expr.unary.op] bullet 3.1 as follows:

The operand of the unary & operator shall be an lvalue of some type T.