Bug 68723 - [4.9/5/6/7 Regression] ice in pop_nested_namespace, at cp/name-lookup.c:3816
Summary: [4.9/5/6/7 Regression] ice in pop_nested_namespace, at cp/name-lookup.c:3816
Status: RESOLVED DUPLICATE of bug 60385
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 6.0
: P4 normal
Target Milestone: 4.9.4
Assignee: Not yet assigned to anyone
URL:
Keywords: error-recovery, ice-on-invalid-code
Depends on:
Blocks:
 
Reported: 2015-12-05 18:28 UTC by John Regehr
Modified: 2016-05-27 15:53 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2015-12-16 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Regehr 2015-12-05 18:28:35 UTC
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.
Comment 1 Jakub Jelinek 2016-03-14 09:03:45 UTC
Started with r158075.
Comment 2 Paolo Carlini 2016-05-27 15:53:48 UTC
Dup. Being an ICE on invalid, I'm not going to fix it only in trunk.

*** This bug has been marked as a duplicate of bug 60385 ***