view gcc/testsuite/g++.dg/template/pr55843.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

template< typename T > struct type_wrapper {
};
typedef char (&yes_tag)[2];
template<bool b> struct if_c {
};
template< typename T > struct has_type {
  struct gcc_3_2_wknd {
    template< typename U > static yes_tag test( type_wrapper<U> const volatile* // { dg-message "" }
, type_wrapper<typename U::type>* = 0 );
  };
  typedef type_wrapper<T> t_;
  static const bool value = sizeof(gcc_3_2_wknd::test(static_cast<t_*>(0))) == // { dg-message "" }
sizeof(yes_tag);
};
template <class K, class T, class=void> struct Get_type {
};
struct FT_tag {};
struct RT_tag {};
template <class K> struct Get_type<K, RT_tag, typename if_c<
!has_type<Get_type<K, FT_tag> >::value >::type> { }; // { dg-message "required" }
template <class K> struct Get_type<K, FT_tag, typename if_c<
!has_type<Get_type<K, RT_tag> >::value >::type> { };  // { dg-message "required" }
typedef Get_type<int, FT_tag>::type P;		      // { dg-message "" }