https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82782
Bug ID: 82782 Summary: ICE: nested template alias and specialized template with auto template parameter Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: rbock at eudoxos dot de Target Milestone: --- Follow up to bug 82085: This valid code now creates an internal compiler error: // ----------------------------------------- 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 Minimized example, based on this code: you can observe the code here: https://github.com/rbock/sqlpp17/tree/1c424f9c1e4d9d9fa7e1c0cb48d27aec190f0da7 Compile with something something like: export SOURCE_ROOT=$HOME/projects/sqlpp17 /usr/local/gcc-trunk/bin/g++ -I$SOURCE_ROOT/include -I$SOURCE_ROOT/tests -std=c++1z -Wall -Wpedantic $SOURCE_ROOT/tests/serialize/join.cpp