[clang] [clang] pointer to member with qualified-id enclosed in parentheses in unevaluated context should be invalid (PR #89713)

Hubert Tong via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 19 22:09:36 PDT 2024


hubert-reinterpretcast wrote:

> PS: Sorry for misunderstanding the original issue.

Totally understandable. Thanks for following up on this.

> These changes pass all tests above:

Can you check this case with your build?
```cpp
struct A { int x; };

char q(int *);
short q(int A::*);

template <typename T>
constexpr int f(char (*)[sizeof(q(&T::x))]) { return 1; }

template <typename T>
constexpr int f(char (*)[sizeof(q(&(T::x)))]) { return 2; }

constexpr int g(char (*p)[sizeof(char)] = 0) { return f<A>(p); }
constexpr int h(char (*p)[sizeof(short)] = 0) { return f<A>(p); }

static_assert(g() == 2);
static_assert(h() == 1);
```

https://github.com/llvm/llvm-project/pull/89713


More information about the cfe-commits mailing list