https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81180
Bug ID: 81180 Summary: internal compiler error with class template deduction in nested template class Product: gcc Version: 7.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: benni.buch at gmail dot com Target Milestone: --- template < int I > struct int_{}; template < typename T > struct A{ template < typename U, int I > struct B{ B(U u, int_< I >){} }; }; int main(){ A< int >::B v(0, int_< 0 >()); (void)v; } results in: $ g++-7.1 -std=c++1z -o main gcc-bug.cpp gcc-bug.cpp: In function 'int main()': gcc-bug.cpp:7:3: internal compiler error: unexpected expression 'I' of kind template_parm_index B(U u, int_< I >){} ^ 0x7139d9 cxx_eval_constant_expression ../../gcc/gcc/cp/constexpr.c:4582 0x7150f4 cxx_eval_outermost_constant_expr ../../gcc/gcc/cp/constexpr.c:4640 0x716dde maybe_constant_value(tree_node*, tree_node*) ../../gcc/gcc/cp/constexpr.c:4855 0x622b8a convert_nontype_argument ../../gcc/gcc/cp/pt.c:6500 0x622b8a convert_template_argument ../../gcc/gcc/cp/pt.c:7668 0x62347c coerce_template_parms ../../gcc/gcc/cp/pt.c:8128 0x625367 coerce_innermost_template_parms ../../gcc/gcc/cp/pt.c:8219 0x6257e9 lookup_template_class_1 ../../gcc/gcc/cp/pt.c:8664 0x6257e9 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*, int, int) ../../gcc/gcc/cp/pt.c:9009 0x626b61 tsubst_aggr_type ../../gcc/gcc/cp/pt.c:11905 0x627e53 tsubst_decl ../../gcc/gcc/cp/pt.c:12270 0x6170af tsubst(tree_node*, tree_node*, int, tree_node*) ../../gcc/gcc/cp/pt.c:13322 0x61a3bc build_deduction_guide ../../gcc/gcc/cp/pt.c:25058 0x61aefe do_class_deduction ../../gcc/gcc/cp/pt.c:25235 0x61aefe do_auto_deduction(tree_node*, tree_node*, tree_node*, int, auto_deduction_context, tree_node*, int) ../../gcc/gcc/cp/pt.c:25341 0x5f7bbb cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int) ../../gcc/gcc/cp/decl.c:6835 0x6870e7 cp_parser_init_declarator ../../gcc/gcc/cp/parser.c:19380 0x68792d cp_parser_simple_declaration ../../gcc/gcc/cp/parser.c:12777 0x688535 cp_parser_block_declaration ../../gcc/gcc/cp/parser.c:12602 0x688e49 cp_parser_declaration_statement ../../gcc/gcc/cp/parser.c:12212 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. Compiled with: $ g++-7.1 --version g++-7.1 (GCC) 7.1.1 20170509 Copyright (C) 2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.