https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116011

--- Comment #8 from Hubert Tong <hstong at ca dot ibm.com> ---
(In reply to Andrew Pinski from comment #7)
> Those are all unevulated context.that is sizeof and decltype are both
> considered unevulated context. In them, gcc does not think &(T::x) and &T::x
> act differently.

I am not seeing how you reached the conclusion that GCC does not think &(T::x)
and &T::x act differently.

GCC compiles this fine (that is, the second `f` accepts an `int *`):
```
struct A { int x; };

template <typename T>
int f(decltype(&T::x) pm, T *tp) {
  return tp->*pm;
}

template <typename T>
int f(decltype(&(T::x)) p) {
  return *p;
}

int g(A *ap, int i) {
  return f<A>(&A::x, ap) + f<A>(&i);
}
```

Reply via email to