1 // Source: Comment 16 of PR51213 2 // { dg-do compile { target c++11 } } 3 4 template <class T> 5 T && declval(); 6 7 template <class T> 8 constexpr auto hasSize(int) -> decltype(declval<T&>().size(), bool()) 9 { return true; } 10 11 template <class T> hasSize(...)12constexpr bool hasSize(...) 13 { return false; } 14 15 struct A 16 { 17 int size(); 18 }; 19 20 struct B : private A 21 { 22 }; 23 24 static_assert(hasSize<A>(0), "A"); 25 static_assert(!hasSize<B>(0), "B"); 26