https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71718
Bug ID: 71718 Summary: ICE on erroneous recursive template error printing Product: gcc Version: 6.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- template <typename T> class A : T{}; template <typename T> using sp = A<T>; struct Base {}; template <typename T, int num = 1> const sp<T> rec() { return rec<T, num - 1>(); } static void f(void) { rec<Base>(); } ----------------------- This erroneous code compiled with g++ (6.1.0) produces an ice with the following backtrace. -------------------- 0x62b536 push_tinst_level_loc(tree_node*, unsigned int) ../../gcc-6.1.0/gcc/cp/pt.c:9077 0x63c942 push_tinst_level(tree_node*) ../../gcc-6.1.0/gcc/cp/pt.c:9061 0x63c942 instantiate_alias_template ../../gcc-6.1.0/gcc/cp/pt.c:17466 0x63c942 tsubst(tree_node*, tree_node*, int, tree_node*) ../../gcc-6.1.0/gcc/cp/pt.c:12842 0x66fef0 dump_template_bindings ../../gcc-6.1.0/gcc/cp/error.c:349 0x66fef0 dump_substitution ../../gcc-6.1.0/gcc/cp/error.c:1450 0x675964 decl_to_string ../../gcc-6.1.0/gcc/cp/error.c:2955 0x675964 cp_printer ../../gcc-6.1.0/gcc/cp/error.c:3535 0x115928c pp_format(pretty_printer*, text_info*) ../../gcc-6.1.0/gcc/pretty-print.c:631 0x1159ff0 pp_format_verbatim(pretty_printer*, text_info*) ../../gcc-6.1.0/gcc/pretty-print.c:690 0x115a0c4 pp_verbatim(pretty_printer*, char const*, ...) ../../gcc-6.1.0/gcc/pretty-print.c:891 0x66f029 print_instantiation_partial_context_line ../../gcc-6.1.0/gcc/cp/error.c:3335 0x66f029 print_instantiation_partial_context ../../gcc-6.1.0/gcc/cp/error.c:3445 0x66f029 print_instantiation_full_context ../../gcc-6.1.0/gcc/cp/error.c:3324 0x66f029 maybe_print_instantiation_context ../../gcc-6.1.0/gcc/cp/error.c:3461 0x67313f cp_diagnostic_starter ../../gcc-6.1.0/gcc/cp/error.c:3154 0x1154e97 diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*) ../../gcc-6.1.0/gcc/diagnostic.c:824 0x11562a1 fatal_error(unsigned int, char const*, ...) ../../gcc-6.1.0/gcc/diagnostic.c:1239 0x62b536 push_tinst_level_loc(tree_node*, unsigned int) ../../gcc-6.1.0/gcc/cp/pt.c:9077 0x63c942 push_tinst_level(tree_node*) ../../gcc-6.1.0/gcc/cp/pt.c:9061 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.