https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77556
Bug ID: 77556 Summary: ICE on invalid C++ code with non-constant non-type template argument: in convert_nontype_argument, at cp/pt.c:6416 Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: su at cs dot ucdavis.edu Target Milestone: --- It also affects 6.x and is a regression from 5.x. $ g++-trunk -v Using built-in specs. COLLECT_GCC=g++-trunk COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto --prefix=/usr/local/gcc-trunk --disable-bootstrap Thread model: posix gcc version 7.0.0 20160910 (experimental) [trunk revision 240069] (GCC) $ $ g++-trunk -c small.cpp small.cpp: In function ‘void f()’: small.cpp:5:40: internal compiler error: in convert_nontype_argument, at cp/pt.c:6416 L1: L2: A < (long) &&L2 - (long) &&L1 > a; ^ 0x6f1717 convert_nontype_argument ../../gcc-source-trunk/gcc/cp/pt.c:6416 0x6f8323 convert_template_argument ../../gcc-source-trunk/gcc/cp/pt.c:7285 0x7039f3 coerce_template_parms ../../gcc-source-trunk/gcc/cp/pt.c:7747 0x70592a lookup_template_class_1 ../../gcc-source-trunk/gcc/cp/pt.c:8320 0x70592a lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*, int, int) ../../gcc-source-trunk/gcc/cp/pt.c:8663 0x8238bd finish_template_type(tree_node*, tree_node*, int) ../../gcc-source-trunk/gcc/cp/semantics.c:3140 0x7ab894 cp_parser_template_id ../../gcc-source-trunk/gcc/cp/parser.c:15049 0x7abb3a cp_parser_class_name ../../gcc-source-trunk/gcc/cp/parser.c:21354 0x79d1ed cp_parser_qualifying_entity ../../gcc-source-trunk/gcc/cp/parser.c:6278 0x79d1ed cp_parser_nested_name_specifier_opt ../../gcc-source-trunk/gcc/cp/parser.c:5962 0x79b32d cp_parser_simple_type_specifier ../../gcc-source-trunk/gcc/cp/parser.c:16372 0x798891 cp_parser_type_specifier ../../gcc-source-trunk/gcc/cp/parser.c:16049 0x7ac253 cp_parser_decl_specifier_seq ../../gcc-source-trunk/gcc/cp/parser.c:12889 0x7b94a1 cp_parser_simple_declaration ../../gcc-source-trunk/gcc/cp/parser.c:12416 0x7b9921 cp_parser_block_declaration ../../gcc-source-trunk/gcc/cp/parser.c:12363 0x7ba378 cp_parser_declaration_statement ../../gcc-source-trunk/gcc/cp/parser.c:11975 0x7b6d0b cp_parser_statement ../../gcc-source-trunk/gcc/cp/parser.c:10581 0x7b783c cp_parser_statement_seq_opt ../../gcc-source-trunk/gcc/cp/parser.c:10859 0x7b792f cp_parser_compound_statement ../../gcc-source-trunk/gcc/cp/parser.c:10813 0x7b7adf cp_parser_function_body ../../gcc-source-trunk/gcc/cp/parser.c:20832 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. $ ----------------------------------------------- template < int > struct A {}; void f () { L1: L2: A < (long) &&L2 - (long) &&L1 > a; }