[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
Wed Jul 17 19:19:49 PDT 2024


hubert-reinterpretcast wrote:

For info, the cases where the _id-expression_ is transformed into a class member access expression (`q` and `h` below) do not run into this code (see https://cplusplus.github.io/CWG/issues/2902.html regarding said transformation):
```cpp
#include <type_traits>
struct S {
  int x;

  bool q = std::is_same_v<decltype(&(S::x)), int *>; // OK

  static void f() {
    static_assert(std::is_same_v<decltype(&(S::x)), int *>, ""); // OK
  }
  void g(this const S &) {
    static_assert(std::is_same_v<decltype(&(S::x)), int *>, ""); // OK
  }
  void h() const {
    static_assert(std::is_same_v<decltype(&(S::x)), const int *>, ""); // OK
  }
};

static_assert(S{0}.q);
```

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


More information about the cfe-commits mailing list