1 template< typename T > struct type_wrapper { 2 }; 3 typedef char (&yes_tag)[2]; 4 template<bool b> struct if_c { 5 }; 6 template< typename T > struct has_type { 7 struct gcc_3_2_wknd { 8 template< typename U > static yes_tag test( type_wrapper<U> const volatile* // { dg-message "" } 9 , type_wrapper<typename U::type>* = 0 ); 10 }; 11 typedef type_wrapper<T> t_; 12 static const bool value = sizeof(gcc_3_2_wknd::test(static_cast<t_*>(0))) == // { dg-message "" } 13 sizeof(yes_tag); 14 }; 15 template <class K, class T, class=void> struct Get_type { 16 }; 17 struct FT_tag {}; 18 struct RT_tag {}; 19 template <class K> struct Get_type<K, RT_tag, typename if_c< 20 !has_type<Get_type<K, FT_tag> >::value >::type> { }; // { dg-message "required" } 21 template <class K> struct Get_type<K, FT_tag, typename if_c< 22 !has_type<Get_type<K, RT_tag> >::value >::type> { }; // { dg-message "required" } 23 typedef Get_type<int, FT_tag>::type P; // { dg-message "" } 24