https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67130
Bug ID: 67130 Summary: [6 Regression] ICE: tree check: expected identifier_node, have template_decl in write_unqualified_id, at cp/mangle.c:1218 Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: trippels at gcc dot gnu.org CC: jason at gcc dot gnu.org Target Milestone: --- trippels@gcc2-power8 test % cat type_traits.ii namespace std { template <typename> struct __success_type; template <typename> void declval(); template <typename> class decay { public: typedef int type; }; template <typename...> struct common_type; struct A { template <typename, typename _Up> static __success_type<typename decay<decltype(declval<_Up>)>::type> _S_test; }; template <typename _Tp, typename _Up> struct __common_type_impl : A { typedef decltype(_S_test<_Tp, _Up>) type; }; template <typename _Tp, typename _Up> struct common_type<_Tp, _Up> : __common_type_impl<_Tp, _Up> {}; } template <typename> struct B { struct _; }; template <typename T> typename B<T>::_ type; template <template <typename...> class> struct C; template <template <typename...> class f> C<f> metafunction; template <typename T> struct B<T>::_ {}; namespace detail { template <typename> struct _decltype; } template <template <typename...> class F> struct C { template <typename... T> auto operator()(T...) -> decltype(type<typename F<detail::_decltype<T>...>::type>); }; auto common_type = metafunction<std::common_type>(0, 0); trippels@gcc2-power8 test % c++ -c type_traits.ii type_traits.ii: In instantiation of ‘decltype (type<typename F<detail::_decltype<T>...>::type>) C< <template-parameter-1-1> >::operator()(T ...) [with T = {int, int}; F = std::common_type; decltype (type<typename F<detail::_decltype<T>...>::type>) = B<std::__success_type<int> >::_; typename F<detail::_decltype<T>...>::type = std::__success_type<int>]’: type_traits.ii:29:8: internal compiler error: tree check: expected identifier_node, have template_decl in write_unqualified_id, at cp/mangle.c:1218 auto operator()(T...) ^ 0x10d2be23 tree_check_failed(tree_node const*, char const*, int, char const*, ...) ../../gcc/gcc/tree.c:9499 0x103d188f tree_check ../../gcc/gcc/tree.h:2858 0x103d188f write_unqualified_id ../../gcc/gcc/cp/mangle.c:1218 0x103cb5ab write_expression ../../gcc/gcc/cp/mangle.c:2828 0x103cf47f write_type ../../gcc/gcc/cp/mangle.c:2129 0x103d1ec7 write_bare_function_type ../../gcc/gcc/cp/mangle.c:2527 0x103d4a67 mangle_decl_string ../../gcc/gcc/cp/mangle.c:3498 0x103d4c7f get_mangled_id ../../gcc/gcc/cp/mangle.c:3520 0x103d504f mangle_decl(tree_node*) ../../gcc/gcc/cp/mangle.c:3587 0x10d2d30f decl_assembler_name(tree_node*) ../../gcc/gcc/tree.c:658 0x1056c583 symbol_table::insert_to_assembler_name_hash(symtab_node*, bool) ../../gcc/gcc/symtab.c:157 0x1056d86f symbol_table::symtab_initialize_asm_name_hash() ../../gcc/gcc/symtab.c:249 0x1058a3ff analyze_functions ../../gcc/gcc/cgraphunit.c:1175 0x1058b267 symbol_table::finalize_compilation_unit() ../../gcc/gcc/cgraphunit.c:2477 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions.