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

--- Comment #9 from Roland B <rbock at eudoxos dot de> ---
Here is the new minimal example (please let me know if this should go into a
new bug report):

// -----------------------------------------
template <const auto& Value>
struct make_char_sequence;

template <int N, const char (&StringLiteral)[N]>
struct make_char_sequence<StringLiteral>
{
  using type = int;
};

template <const auto& StringLiteral>
using make_char_sequence_t = typename make_char_sequence<StringLiteral>::type;

inline constexpr char sample[] = "Sample";

using X = make_char_sequence_t<sample>;
// -----------------------------------------

g++ (GCC) 8.0.0 20171030 (experimental)

test.cpp: In substitution of ‘template<const auto& StringLiteral> using
make_char_sequence_t = typename make_char_sequence::type [with const auto&
StringLiteral = sample]’:
test.cpp:15:38:   required from here
test.cpp:11:78: internal compiler error: unexpected expression ‘N’ of kind
template_parm_index
 using make_char_sequence_t = typename make_char_sequence<StringLiteral>::type;
                                                                              ^
0x6bd33a cxx_eval_constant_expression
        ../../gcc-trunk/gcc/cp/constexpr.c:4638
0x6c197d cxx_eval_outermost_constant_expr
        ../../gcc-trunk/gcc/cp/constexpr.c:4697
0x6c4c46 maybe_constant_value(tree_node*, tree_node*)
        ../../gcc-trunk/gcc/cp/constexpr.c:4912
0x7198b4 compute_array_index_type(tree_node*, tree_node*, int)
        ../../gcc-trunk/gcc/cp/decl.c:9349
0x833768 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc-trunk/gcc/cp/pt.c:13680
0x833538 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc-trunk/gcc/cp/pt.c:14137
0x83312b tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc-trunk/gcc/cp/pt.c:13626
0x82e7f5 unify
        ../../gcc-trunk/gcc/cp/pt.c:20908
0x82f40f unify
        ../../gcc-trunk/gcc/cp/pt.c:21328
0x82f1e7 unify
        ../../gcc-trunk/gcc/cp/pt.c:21100
0x830232 get_partial_spec_bindings
        ../../gcc-trunk/gcc/cp/pt.c:21906
0x830ab1 most_specialized_partial_spec
        ../../gcc-trunk/gcc/cp/pt.c:22178
0x858107 instantiate_class_template_1
        ../../gcc-trunk/gcc/cp/pt.c:10341
0x858107 instantiate_class_template(tree_node*)
        ../../gcc-trunk/gcc/cp/pt.c:10909
0x8b12a2 complete_type(tree_node*)
        ../../gcc-trunk/gcc/cp/typeck.c:136
0x83403f tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc-trunk/gcc/cp/pt.c:14208
0x83dec6 tsubst_decl
        ../../gcc-trunk/gcc/cp/pt.c:13043
0x833e17 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc-trunk/gcc/cp/pt.c:13553
0x83130d instantiate_template_1
        ../../gcc-trunk/gcc/cp/pt.c:18502
0x83130d instantiate_template(tree_node*, tree_node*, int)
        ../../gcc-trunk/gcc/cp/pt.c:18558

Reply via email to