1 // PR c++/56208 2 // { dg-do compile { target c++11 } } 3 4 struct ostream { 5 ostream& operator<<(int); 6 }; 7 8 struct sfinae_base { 9 10 typedef char one; 11 typedef char (&two)[2]; 12 13 template<class T> 14 static T make(); 15 16 template<unsigned> struct ok { typedef int type; }; 17 18 template<class U, class T> 19 static one test(decltype((make<U>() << make<T>()), 0)); 20 21 template<class, class> 22 static two test(...); 23 }; 24 25 template<class T> 26 struct is_printable : private sfinae_base 27 { 28 enum { value = sizeof(test<ostream&, T>(0)) == sizeof(one) }; 29 }; 30 31 typedef int ok[is_printable<int>::value ? 1 : -1]; 32