https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77549
Bug ID: 77549 Summary: ICE on invalid C++ code that references undeclared variable Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: su at cs dot ucdavis.edu Target Milestone: --- This is a regression from 6.2.x. $ 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 20160909 (experimental) [trunk revision 240043] (GCC) $ $ g++-6.2 -c small.cpp small.cpp: In function ‘void f()’: small.cpp:9:3: error: ‘x’ was not declared in this scope x; ^ $ $ g++-trunk -c small.cpp small.cpp: In function ‘void f()’: small.cpp:9:3: error: ‘x’ was not declared in this scope x; ^ small.cpp:9:3: 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 0x1087684 tree_contains_struct_check_failed(tree_node const*, tree_node_structure_enum, char const*, int, char const*) ../../gcc-source-trunk/gcc/tree.c:9914 0x877ccc contains_struct_check ../../gcc-source-trunk/gcc/tree.h:3140 0x877ccc consider_binding_level ../../gcc-source-trunk/gcc/cp/name-lookup.c:4721 0x87daba lookup_name_fuzzy(tree_node*, lookup_name_fuzzy_kind) ../../gcc-source-trunk/gcc/cp/name-lookup.c:4742 0x880fac suggest_alternatives_for(unsigned int, tree_node*) ../../gcc-source-trunk/gcc/cp/name-lookup.c:4445 0x7841b8 unqualified_name_lookup_error(tree_node*, unsigned int) ../../gcc-source-trunk/gcc/cp/lex.c:461 0x79b2f1 cp_parser_postfix_expression ../../gcc-source-trunk/gcc/cp/parser.c:6742 0x799bac cp_parser_unary_expression ../../gcc-source-trunk/gcc/cp/parser.c:8019 0x7a3a57 cp_parser_cast_expression ../../gcc-source-trunk/gcc/cp/parser.c:8696 0x7a4055 cp_parser_binary_expression ../../gcc-source-trunk/gcc/cp/parser.c:8798 0x7a4940 cp_parser_assignment_expression ../../gcc-source-trunk/gcc/cp/parser.c:9086 0x7a7239 cp_parser_expression ../../gcc-source-trunk/gcc/cp/parser.c:9253 0x7a785f cp_parser_expression_statement ../../gcc-source-trunk/gcc/cp/parser.c:10736 0x7b619c cp_parser_statement ../../gcc-source-trunk/gcc/cp/parser.c:10587 0x7b711c cp_parser_statement_seq_opt ../../gcc-source-trunk/gcc/cp/parser.c:10859 0x7b720f cp_parser_compound_statement ../../gcc-source-trunk/gcc/cp/parser.c:10813 0x7b73bf cp_parser_function_body ../../gcc-source-trunk/gcc/cp/parser.c:20832 0x7b73bf cp_parser_ctor_initializer_opt_and_function_body ../../gcc-source-trunk/gcc/cp/parser.c:20868 0x7b7e61 cp_parser_function_definition_after_declarator ../../gcc-source-trunk/gcc/cp/parser.c:25565 0x7b8b75 cp_parser_function_definition_from_specifiers_and_declarator ../../gcc-source-trunk/gcc/cp/parser.c:25477 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. $ ----------------------- struct A { static int x; }; void f () { using ::A; x; }