https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81246
Bug ID: 81246 Summary: ICC on invalid C++ code (with a non-type template parameter having type 'float'): Segmentation fault Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: su at cs dot ucdavis.edu Target Milestone: --- $ 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/8.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 8.0.0 20170629 (experimental) [trunk revision 249769] (GCC) $ $ g++-trunk -c small.cpp small.cpp: In instantiation of ‘class N::A<float>’: small.cpp:8:15: required from here small.cpp:5:33: error: ‘float’ is not a valid type for a template non-type parameter template < T > friend class B; ^ small.cpp:3:33: internal compiler error: Segmentation fault template < typename T > class A ^ 0xe44eff crash_signal ../../gcc-source-trunk/gcc/toplev.c:338 0x6be3e3 tree_class_check ../../gcc-source-trunk/gcc/tree.h:3205 0x6be3e3 pop_nested_class() ../../gcc-source-trunk/gcc/cp/class.c:7985 0x87ec99 instantiate_class_template_1 ../../gcc-source-trunk/gcc/cp/pt.c:10899 0x87ec99 instantiate_class_template(tree_node*) ../../gcc-source-trunk/gcc/cp/pt.c:10923 0x8dac2a complete_type(tree_node*) ../../gcc-source-trunk/gcc/cp/typeck.c:134 0x7232e8 start_decl_1(tree_node*, bool) ../../gcc-source-trunk/gcc/cp/decl.c:5147 0x749c0d start_decl(cp_declarator const*, cp_decl_specifier_seq*, int, tree_node*, tree_node*, tree_node**) ../../gcc-source-trunk/gcc/cp/decl.c:5110 0x806698 cp_parser_init_declarator ../../gcc-source-trunk/gcc/cp/parser.c:19410 0x809308 cp_parser_simple_declaration ../../gcc-source-trunk/gcc/cp/parser.c:12945 0x80a0a1 cp_parser_block_declaration ../../gcc-source-trunk/gcc/cp/parser.c:12763 0x811bc0 cp_parser_declaration ../../gcc-source-trunk/gcc/cp/parser.c:12660 0x810894 cp_parser_declaration_seq_opt ../../gcc-source-trunk/gcc/cp/parser.c:12536 0x810f6c cp_parser_namespace_body ../../gcc-source-trunk/gcc/cp/parser.c:18424 0x810f6c cp_parser_namespace_definition ../../gcc-source-trunk/gcc/cp/parser.c:18403 0x811ceb cp_parser_declaration ../../gcc-source-trunk/gcc/cp/parser.c:12644 0x810894 cp_parser_declaration_seq_opt ../../gcc-source-trunk/gcc/cp/parser.c:12536 0x810bd8 cp_parser_translation_unit ../../gcc-source-trunk/gcc/cp/parser.c:4386 0x810bd8 c_parse_file() ../../gcc-source-trunk/gcc/cp/parser.c:38642 0x9590e5 c_common_parse_file() ../../gcc-source-trunk/gcc/c-family/c-opts.c:1104 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. $ --------------------------------------- namespace N { template < typename T > class A { template < T > friend class B; }; A < float > a; }