https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72774
Bug ID: 72774 Summary: ICE on invalid C++ code on x86_64-linux-gnu (tree check: expected tree that contains ‘decl minimal’ structure, have ‘tree_list’ in consider_binding_level, at cp/name-lookup.c:4721) 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: --- $ 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 20160802 (experimental) [trunk revision 238976] (GCC) $ g++-trunk small.C small.C: In function ‘void bar()’: small.C:7:19: internal compiler error: tree check: expected tree that contains ‘decl minimal’ structure, have ‘tree_list’ in consider_binding_level, at cp/name-lookup.c:4721 0 ? static_cast<g>(0) : __assert_fail; ^ 0x103eed4 tree_contains_struct_check_failed(tree_node const*, tree_node_structure_enum, char const*, int, char const*) ../../gcc-source-trunk/gcc/tree.c:9914 0x87cb28 contains_struct_check(tree_node*, tree_node_structure_enum, char const*, int, char const*) ../../gcc-source-trunk/gcc/tree.h:3137 0x87cb28 consider_binding_level ../../gcc-source-trunk/gcc/cp/name-lookup.c:4721 0x88272a lookup_name_fuzzy(tree_node*, lookup_name_fuzzy_kind) ../../gcc-source-trunk/gcc/cp/name-lookup.c:4742 0x791d5d cp_parser_diagnose_invalid_type_name ../../gcc-source-trunk/gcc/cp/parser.c:3168 0x7b437d cp_parser_parse_and_diagnose_invalid_type_name ../../gcc-source-trunk/gcc/cp/parser.c:3327 0x7a0317 cp_parser_type_specifier_seq ../../gcc-source-trunk/gcc/cp/parser.c:20107 0x7aaa62 cp_parser_type_id_1 ../../gcc-source-trunk/gcc/cp/parser.c:19957 0x7a2b99 cp_parser_postfix_expression ../../gcc-source-trunk/gcc/cp/parser.c:6406 0x7a0c8c cp_parser_unary_expression ../../gcc-source-trunk/gcc/cp/parser.c:8012 0x7aac27 cp_parser_cast_expression ../../gcc-source-trunk/gcc/cp/parser.c:8689 0x7ab1db cp_parser_binary_expression ../../gcc-source-trunk/gcc/cp/parser.c:8790 0x7abaa0 cp_parser_assignment_expression ../../gcc-source-trunk/gcc/cp/parser.c:9077 0x7ae3fa cp_parser_expression ../../gcc-source-trunk/gcc/cp/parser.c:9246 0x7abbbd cp_parser_question_colon_clause ../../gcc-source-trunk/gcc/cp/parser.c:9020 0x7abbbd cp_parser_assignment_expression ../../gcc-source-trunk/gcc/cp/parser.c:9083 0x7ae3fa cp_parser_expression ../../gcc-source-trunk/gcc/cp/parser.c:9246 0x7ae9a3 cp_parser_expression_statement ../../gcc-source-trunk/gcc/cp/parser.c:10709 0x7bdcc6 cp_parser_statement ../../gcc-source-trunk/gcc/cp/parser.c:10560 0x7be6ac cp_parser_statement_seq_opt ../../gcc-source-trunk/gcc/cp/parser.c:10832 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 void __assert_fail(); namespace A { void g(); } void bar() { using A::g; 0 ? static_cast<g>(0) : __assert_fail; } $