[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 09:24:06 PDT 2024


hubert-reinterpretcast wrote:

Indeed, the new diagnostic is never valid because the permission to name non-static data members in unevaluated operands is not restricted by scope: https://eel.is/c++draft/expr.prim.id.general#4.3

https://gcc.godbolt.org/z/h4eTT984M:
```cpp
namespace std {
  template <typename, typename>
  struct is_same { static constexpr bool value = false; };

  template <typename T>
  struct is_same<T, T> { static constexpr bool value = true; };
}
 
struct S {
    int x;
    static_assert(std::is_same<decltype((S::x)), int &>::value, "");
    static_assert(std::is_same<decltype(&(S::x)), int *>::value, "");
};
static_assert(std::is_same<decltype((S::x)), int &>::value, "");
static_assert(std::is_same<decltype(&(S::x)), int *>::value, "");
```


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


More information about the cfe-commits mailing list