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

            Bug ID: 63522
           Summary: [4.8/4.9/5.0] ICE: unexpected expression
                    'ElementIndices' of kind template_parm_index
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lucdanton at free dot fr

Created attachment 33696
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33696&action=edit
Minimal testcase

Attempting to compile the minimal testcase produces "internal compiler error:
unexpected expression 'ElementIndices' of kind template_parm_index". I have
tried the following versions:

$ g++-trunk --version
g++-trunk (GCC) 5.0.0 20141009 (experimental)

$ g++ --version
g++ (Ubuntu 4.8.2-19ubuntu1) 4.8.2

$ g++-4.9
g++-4.9 (GCC) 4.9.0

Program fragment:
--------------------

template <typename...> struct tuple;
template <typename...> void slice();
template <int Index, typename...> using slice_result = decltype(slice<Index>);
template <typename Tuple, typename... Tuples, int... ElementIndices,
          typename =
              typename tuple<slice_result<ElementIndices, Tuples...>,
                             slice_result<ElementIndices, Tuples...>...>::type>
void zip_with(Tuple...);
decltype(zip_with(0))

----------------------------------------

Here is the full invocation and error using the snapshot of trunk:

$ g++-trunk -std=c++11 main.cpp 
main.cpp: In substitution of 'template<int Index, class ...> using slice_result
= decltype (slice<Index>) [with int Index = ElementIndices;
<template-parameter-1-2> = {}]':
main.cpp:5:11:   required by substitution of 'template<class Tuple, class ...
Tuples, int ...ElementIndices, class> void zip_with(Tuple, ...) [with Tuple =
int; Tuples = {}; int ...ElementIndices = {}; <template-parameter-1-4> =
<missing>]'
main.cpp:9:20:   required from here
main.cpp:5:11: internal compiler error: unexpected expression 'ElementIndices'
of kind template_parm_index
           typename =
           ^
0x6755a7 cxx_eval_constant_expression
    ../../gcc/gcc/cp/semantics.c:10050
0x676de6 cxx_eval_outermost_constant_expr
    ../../gcc/gcc/cp/semantics.c:10070
0x5dd190 convert_nontype_argument
    ../../gcc/gcc/cp/pt.c:5759
0x5dd190 convert_template_argument
    ../../gcc/gcc/cp/pt.c:6657
0x5deb5c coerce_template_parms
    ../../gcc/gcc/cp/pt.c:7081
0x5daa28 coerce_innermost_template_parms
    ../../gcc/gcc/cp/pt.c:7165
0x5daa28 instantiate_alias_template
    ../../gcc/gcc/cp/pt.c:15909
0x5daa28 tsubst(tree_node*, tree_node*, int, tree_node*)
    ../../gcc/gcc/cp/pt.c:11723
0x5de392 tsubst_template_args
    ../../gcc/gcc/cp/pt.c:10123
0x5de58f tsubst_template_args
    ../../gcc/gcc/cp/pt.c:10105
0x5e09d0 tsubst_aggr_type
    ../../gcc/gcc/cp/pt.c:10320
0x5da0cf tsubst(tree_node*, tree_node*, int, tree_node*)
    ../../gcc/gcc/cp/pt.c:12299
0x5e4125 type_unification_real
    ../../gcc/gcc/cp/pt.c:16841
0x5e741f fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, bool, bool)
    ../../gcc/gcc/cp/pt.c:16177
0x5a5ca8 add_template_candidate_real
    ../../gcc/gcc/cp/call.c:3025
0x5a6371 add_template_candidate
    ../../gcc/gcc/cp/call.c:3122
0x5a6371 add_candidates
    ../../gcc/gcc/cp/call.c:5253
0x5a797d perform_overload_resolution
    ../../gcc/gcc/cp/call.c:3971
0x5a93ea build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, bool, int)
    ../../gcc/gcc/cp/call.c:4048
0x66ce39 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
    ../../gcc/gcc/cp/semantics.c:2368
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.

Reply via email to