Debian Codegraph @

gcc/testsuite/g++.dg/cpp0x/sfinae29.C

raw
1 // PR c++/51047
2 // { dg-do compile { target c++11 } }
3
4 template<typename T> T &&declval();
5 template<class T> decltype(declval<T>().x) f(T *);
6 template<class T> char f(T);
7 struct B1{ int x; };
8 struct B2{ int x; };
9 struct D : public B1, B2{};
10 struct S { int x; };
11 int main()
12 {
13 S *p = nullptr;
14 static_assert(sizeof(f(p)) == sizeof(int), "");
15 D *q = nullptr;
16 static_assert(sizeof(f(q)) == 1u, "");
17 }