https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68723
Bug ID: 68723 Summary: ice in pop_nested_namespace, at cp/name-lookup.c:3816 Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: regehr at cs dot utah.edu Target Milestone: --- ICE on invalid code $ g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/home/regehr/z/compiler-install/gcc-r231259-install/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /home/regehr/z/compiler-source/gcc/configure --prefix=/home/regehr/z/compiler-install/gcc-r231259-install --disable-bootstrap --disable-multilib --enable-languages=c,c++ Thread model: posix gcc version 6.0.0 20151204 (experimental) (GCC) $ cat hello.cpp struct Trans_NS_std_std; namespace Trans_NS_std_std class A { friend fn1 ( exception_ptr, $ g++ -w -std=c++11 hello.cpp hello.cpp:2:11: error: ‘namespace Trans_NS_std_std { }’ redeclared as different kind of symbol namespace Trans_NS_std_std class A { ^~~~~~~~~~~~~~~~ hello.cpp:1:8: note: previous declaration ‘struct Trans_NS_std_std’ struct Trans_NS_std_std; ^~~~~~~~~~~~~~~~ hello.cpp:2:28: error: expected ‘{’ before ‘class’ namespace Trans_NS_std_std class A { ^~~~~ hello.cpp:3:22: error: ‘exception_ptr’ has not been declared friend fn1 ( exception_ptr, ^~~~~~~~~~~~~ hello.cpp:3:35: error: expected identifier at end of input friend fn1 ( exception_ptr, ^ hello.cpp:3:35: error: expected ‘,’ or ‘...’ at end of input hello.cpp:3:35: error: expected ‘)’ at end of input hello.cpp:3:35: error: ISO C++ forbids declaration of ‘fn1’ with no type [-fpermissive] hello.cpp:3:35: error: ‘namespace Trans_NS_std_std { }’ redeclared as different kind of symbol hello.cpp:1:8: note: previous declaration ‘struct Trans_NS_std_std’ struct Trans_NS_std_std; ^~~~~~~~~~~~~~~~ hello.cpp:3:35: internal compiler error: in pop_nested_namespace, at cp/name-lookup.c:3816 friend fn1 ( exception_ptr, ^ 0x7b8e36 pop_nested_namespace(tree_node*) /home/regehr/z/compiler-source/gcc/gcc/cp/name-lookup.c:3816 0x730838 do_friend(tree_node*, tree_node*, tree_node*, tree_node*, overload_flags, bool) /home/regehr/z/compiler-source/gcc/gcc/cp/friend.c:586 0x5e991a grokdeclarator(cp_declarator const*, cp_decl_specifier_seq*, decl_context, int, tree_node**) /home/regehr/z/compiler-source/gcc/gcc/cp/decl.c:11142 0x6a26b8 grokfield(cp_declarator const*, cp_decl_specifier_seq*, tree_node*, bool, tree_node*, tree_node*) /home/regehr/z/compiler-source/gcc/gcc/cp/decl2.c:873 0x6c2872 cp_parser_member_declaration /home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:22106 0x6c5ba6 cp_parser_member_specification_opt /home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:21653 0x6c5ba6 cp_parser_class_specifier_1 /home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:20845 0x6c85d9 cp_parser_class_specifier /home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:21081 0x6c85d9 cp_parser_type_specifier /home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:15391 0x6e568b cp_parser_decl_specifier_seq /home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:12343 0x6f1221 cp_parser_simple_declaration /home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:11909 0x6f18d0 cp_parser_block_declaration /home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:11856 0x6fdd77 cp_parser_declaration /home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:11753 0x6fc24d cp_parser_declaration_seq_opt /home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:11632 0x6fca03 cp_parser_namespace_body /home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:17160 0x6fca03 cp_parser_namespace_definition /home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:17137 0x6fdcd7 cp_parser_declaration /home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:11737 0x6fc24d cp_parser_declaration_seq_opt /home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:11632 0x6fc598 cp_parser_translation_unit /home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:4189 0x6fc598 c_parse_file() /home/regehr/z/compiler-source/gcc/gcc/cp/parser.c:36844 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.