As was mentioned in other questions, B::x
is a pointer to member of the type int B::*
. Your concept can be based on the fact that such pointer cannot be cast to void*
unlike normal pointers:
template <typename T>
concept C = requires { static_cast<void*>reinterpret_cast<void*>(&T::x); };
It works with all tested compilers: https://gcc.godbolt.org/z/9q8rG5eeohttps://gcc.godbolt.org/z/nr9ecb564