https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78637
Bug ID: 78637 Summary: ICE on invalid C++ code on x86_64-linux-gnu (internal compiler error: in pop_namespace, at cp/name-lookup.c:3826) Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: chengniansun at gmail dot com Target Milestone: --- $ gcc-trunk -v Using built-in specs. COLLECT_GCC=gcc-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 20161201 (experimental) [trunk revision 243118] (GCC) $ $ gcc-trunk small.C small.C:4:14: error: ‘namespace X::Y { }’ redeclared as different kind of symbol namespace X::Y z; ^ small.C:2:7: note: previous declaration ‘class X::Y’ class Y; ^ small.C:4:16: error: expected ‘{’ before ‘z’ namespace X::Y z; ^ small.C:4:16: error: ‘z’ does not name a type small.C:4:17: internal compiler error: in pop_namespace, at cp/name-lookup.c:3826 namespace X::Y z; ^ 0x890072 pop_namespace() ../../gcc-source-trunk/gcc/cp/name-lookup.c:3826 0x7d11bf cp_parser_namespace_definition ../../gcc-source-trunk/gcc/cp/parser.c:18226 0x7d07db cp_parser_declaration ../../gcc-source-trunk/gcc/cp/parser.c:12472 0x7d0ab4 cp_parser_declaration_seq_opt ../../gcc-source-trunk/gcc/cp/parser.c:12364 0x7d0df8 cp_parser_translation_unit ../../gcc-source-trunk/gcc/cp/parser.c:4368 0x7d0df8 c_parse_file() ../../gcc-source-trunk/gcc/cp/parser.c:38262 0x935c32 c_common_parse_file() ../../gcc-source-trunk/gcc/c-family/c-opts.c:1098 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. $ $ cat small.C namespace X { class Y; } namespace X::Y z; $