This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/55843] New: ICE after exceeding template instantiation depth


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55843

             Bug #: 55843
           Summary: ICE after exceeding template instantiation depth
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Keywords: error-recovery, ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: glisse@gcc.gnu.org


Hello,

the following code, compiled without any option, makes cc1plus segfault.
g++-4.7 has a slightly nicer "confused by earlier errors, bailing out".

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*
, 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))) ==
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> { };
template <class K> struct Get_type<K, FT_tag, typename if_c<
!has_type<Get_type<K, RT_tag> >::value >::type> { };
typedef Get_type<int, FT_tag>::type P;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]