#include <type_traits>
struct A {
int foo;
};
struct B : A {};
struct C {
static int foo;
};
struct D : C {};
struct E {
int &foo;
};
struct F {
static int &foo;
};
struct G {};
template <typename T>
std::is_member_pointer<decltype(&T::foo)> is_member_foo(int);
template <typename T>
decltype(T::foo, std::true_type{}) is_member_foo(long);
template <typename T>
std::false_type is_member_foo(...);
template <typename T>
using IsMemberFoo = decltype(is_member_foo<T>(0));
static_assert(IsMemberFoo<A>{}, "No");
static_assert(IsMemberFoo<B>{}, "No");
static_assert(!IsMemberFoo<C>{}, "No");
static_assert(!IsMemberFoo<D>{}, "No");
static_assert(IsMemberFoo<E>{}, "No");
static_assert(!IsMemberFoo<F>{}, "No");
static_assert(!IsMemberFoo<G>{}, "No"); // struct G { };
int main () {}
I2luY2x1ZGUgPHR5cGVfdHJhaXRzPgoKc3RydWN0IEEgewogIGludCBmb287Cn07CgpzdHJ1Y3QgQiA6IEEge307CgpzdHJ1Y3QgQyB7CiAgc3RhdGljIGludCBmb287Cn07CgpzdHJ1Y3QgRCA6IEMge307CgpzdHJ1Y3QgRSB7CiAgaW50ICZmb287Cn07CgpzdHJ1Y3QgRiB7CiAgc3RhdGljIGludCAmZm9vOwp9OwoKc3RydWN0IEcge307Cgp0ZW1wbGF0ZSA8dHlwZW5hbWUgVD4Kc3RkOjppc19tZW1iZXJfcG9pbnRlcjxkZWNsdHlwZSgmVDo6Zm9vKT4gaXNfbWVtYmVyX2ZvbyhpbnQpOwoKdGVtcGxhdGUgPHR5cGVuYW1lIFQ+CmRlY2x0eXBlKFQ6OmZvbywgc3RkOjp0cnVlX3R5cGV7fSkgaXNfbWVtYmVyX2Zvbyhsb25nKTsKCnRlbXBsYXRlIDx0eXBlbmFtZSBUPgpzdGQ6OmZhbHNlX3R5cGUgaXNfbWVtYmVyX2ZvbyguLi4pOwoKdGVtcGxhdGUgPHR5cGVuYW1lIFQ+CnVzaW5nIElzTWVtYmVyRm9vID0gZGVjbHR5cGUoaXNfbWVtYmVyX2ZvbzxUPigw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