1 // PR c++/61806 2 // { dg-do compile { target c++11 } } 3 4 struct true_type 5 { 6 static const bool value = true; 7 }; 8 9 struct false_type 10 { 11 static const bool value = false; 12 }; 13 14 template<class T> 15 T&& declval(); 16 17 template<typename> struct check { typedef void type; }; 18 19 template<typename T, typename Enable = void> 20 struct has_public_f : false_type {}; 21 22 template<typename T> 23 struct has_public_f< 24 T, 25 typename check< 26 decltype( 27 declval<T&>().f() 28 ) 29 >::type 30 > : true_type {}; 31 32 33 struct Spub { public: void f(); }; 34 struct Spriv { private: void f(); }; 35 36 static_assert( has_public_f<Spub>::value, "Ouch"); 37 static_assert(!has_public_f<Spriv>::value, "Ouch"); 38 39 int main() {} 40