https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84768

            Bug ID: 84768
           Summary: ICE with failed class template argument deduction
                    because of invalid template parameter
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Keywords: error-recovery, ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: reichelt at gcc dot gnu.org
  Target Milestone: ---

The following invalid code snippet (compiled with "-std=c++1z") triggers
an ICE since 7.1.0 (when class template argument deduction was introduced):

=================================
template<typename> struct A {};

template<typename T> struct B
{
  template<X Y> B(A<T>);
};

B b = A<void>();
=================================

bug.cc:5:12: error: 'X' has not been declared
   template<X Y> B(A<T>);
            ^
bug.cc:8:15: internal compiler error: in get_template_parm_index, at
cp/pt.c:5086
 B b = A<void>();
               ^
0x62ea67 get_template_parm_index
        ../../gcc/gcc/cp/pt.c:5086
0x9639fa rewrite_template_parm
        ../../gcc/gcc/cp/pt.c:25680
0x9639fa build_deduction_guide
        ../../gcc/gcc/cp/pt.c:25870
0x964d95 do_class_deduction
        ../../gcc/gcc/cp/pt.c:26019
0x964d95 do_auto_deduction(tree_node*, tree_node*, tree_node*, int,
auto_deduction_context, tree_node*, int)
        ../../gcc/gcc/cp/pt.c:26147
0x89d343 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
        ../../gcc/gcc/cp/decl.c:6866
0x939523 cp_parser_init_declarator
        ../../gcc/gcc/cp/parser.c:19723
0x940928 cp_parser_simple_declaration
        ../../gcc/gcc/cp/parser.c:13057
0x941738 cp_parser_block_declaration
        ../../gcc/gcc/cp/parser.c:12882
0x945692 cp_parser_declaration
        ../../gcc/gcc/cp/parser.c:12780
0x945aa1 cp_parser_declaration_seq_opt
        ../../gcc/gcc/cp/parser.c:12656
0x945d94 cp_parser_translation_unit
        ../../gcc/gcc/cp/parser.c:4561
0x945d94 c_parse_file()
        ../../gcc/gcc/cp/parser.c:38995
0xa44906 c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.c:1132
Please submit a full bug report, [etc.]

Reply via email to