https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116011
Hubert Tong <hstong at ca dot ibm.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|accepting &(T::x) as a |Template declaration |pointer to member in an |matching does not |unevulated context and not |differentiate between |treating it differently |&(T::x) and &T::x; only the |from &T::x |latter can form a pointer | |to member --- Comment #5 from Hubert Tong <hstong at ca dot ibm.com> --- I updated the summary title again to reflect that the issue is specific to declaration matching. GCC does differentiate between &(T::x) and &T::x (except that it conflates them when matching templated declarations. For example, the following compiles: ``` struct A { int x; }; char q(int *); short q(int A::*); template <typename T> constexpr int f1(char (*)[sizeof(q(&T::x))]) { return 1; } template <typename T> constexpr int f2(char (*)[sizeof(q(&(T::x)))]) { return 2; } constexpr int g(char (*p)[sizeof(char)] = 0) { return f2<A>(p); } constexpr int h(char (*p)[sizeof(short)] = 0) { return f1<A>(p); } static_assert(g() == 2, ""); static_assert(h() == 1, ""); ```