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

            Bug ID: 84702
           Summary: internal compiler error: in tsubst_copy, at
                    cp/pt.c:15082
           Product: gcc
           Version: 8.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vegard.nossum at gmail dot com
                CC: webrown.cpp at gmail dot com
  Target Milestone: ---

Input:

void a();

namespace {
        void a();
}

template<int b = a>
void a() {
        a();
}

Output:

$ xgcc -x c++ -S -
<stdin>: In substitution of 'template<int b> void a() [with int b =
<missing>]':
<stdin>:9:4:   required from here
<stdin>:7:18: internal compiler error: in tsubst_copy, at cp/pt.c:15082
0x10e95f7 tsubst_copy
        /home/vegard/git/gcc/gcc/cp/pt.c:15082
0x10f7da3 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        /home/vegard/git/gcc/gcc/cp/pt.c:17570
0x10c11c6 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        /home/vegard/git/gcc/gcc/cp/pt.c:16984
0x112fffa tsubst_template_arg
        /home/vegard/git/gcc/gcc/cp/pt.c:11071
0x112fffa type_unification_real
        /home/vegard/git/gcc/gcc/cp/pt.c:19977
0x119c519 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, bool, bool)
        /home/vegard/git/gcc/gcc/cp/pt.c:19165
0x907d89 add_template_candidate_real
        /home/vegard/git/gcc/gcc/cp/call.c:3180
0x90af6c add_template_candidate
        /home/vegard/git/gcc/gcc/cp/call.c:3258
0x90af6c add_candidates
        /home/vegard/git/gcc/gcc/cp/call.c:5525
0x9388a9 perform_overload_resolution
        /home/vegard/git/gcc/gcc/cp/call.c:4203
0x9388a9 build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
        /home/vegard/git/gcc/gcc/cp/call.c:4272
0x1281cd6 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**,
bool, bool, int)
        /home/vegard/git/gcc/gcc/cp/semantics.c:2493
0xf7bb98 cp_parser_postfix_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:7244
0xf2e927 cp_parser_unary_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:8320
0xec435a cp_parser_cast_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:9088
0xec6986 cp_parser_binary_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:9189
0xeca75a cp_parser_assignment_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:9484
0xece6c6 cp_parser_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:9653
0xee2c46 cp_parser_expression_statement
        /home/vegard/git/gcc/gcc/cp/parser.c:11129
0xefe550 cp_parser_statement
        /home/vegard/git/gcc/gcc/cp/parser.c:10933

$ xgcc --version
xgcc (GCC) 8.0.1 20180303 (experimental)

Built from git 0d86c284d085d29782d862600a79aa1ff0ee0c47 (r258221).

Could be related to bug #79271 based on the crash message, although I don't see
(a) any constexpr in my test case, (b) any arrays in my test case, (c) any
crash with the test case from that bug on my local compiler.

Test case was minimised by C-Reduce.

Reply via email to