https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72800
Bug ID: 72800 Summary: ICE on invalid C++14 code with initialized lambda capture: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in add_capture, at cp/lambda.c:505 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.1.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 20160802 (experimental) [trunk revision 238983] (GCC) $ $ g++-trunk -c -std=c++14 small.cpp small.cpp: In function ‘void foo()’: small.cpp:4:7: error: direct-list-initialization of ‘auto’ requires exactly one element [-fpermissive] [n {}] {}; ^ small.cpp:4:7: note: for deduction to ‘std::initializer_list’, use copy-list-initialization (i.e. add ‘=’ before the ‘{’) small.cpp:4:7: error: deducing from brace-enclosed initializer list requires #include <initializer_list> small.cpp:4:7: internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in add_capture, at cp/lambda.c:505 0x1071a07 tree_class_check_failed(tree_node const*, tree_code_class, char const*, int, char const*) ../../gcc-source-trunk/gcc/tree.c:9793 0x8a32d4 tree_class_check ../../gcc-source-trunk/gcc/tree.h:3146 0x8a32d4 add_capture(tree_node*, tree_node*, tree_node*, bool, bool) ../../gcc-source-trunk/gcc/cp/lambda.c:505 0x7946cb cp_parser_lambda_introducer ../../gcc-source-trunk/gcc/cp/parser.c:10025 0x7946cb cp_parser_lambda_expression ../../gcc-source-trunk/gcc/cp/parser.c:9733 0x795f6c cp_parser_primary_expression ../../gcc-source-trunk/gcc/cp/parser.c:4960 0x797fe6 cp_parser_postfix_expression ../../gcc-source-trunk/gcc/cp/parser.c:6717 0x7a101c cp_parser_unary_expression ../../gcc-source-trunk/gcc/cp/parser.c:8012 0x7a1877 cp_parser_cast_expression ../../gcc-source-trunk/gcc/cp/parser.c:8689 0x7a1e75 cp_parser_binary_expression ../../gcc-source-trunk/gcc/cp/parser.c:8791 0x7a2760 cp_parser_assignment_expression ../../gcc-source-trunk/gcc/cp/parser.c:9079 0x7a5059 cp_parser_expression ../../gcc-source-trunk/gcc/cp/parser.c:9246 0x7a57cf cp_parser_expression_statement ../../gcc-source-trunk/gcc/cp/parser.c:10709 0x7935fb cp_parser_statement ../../gcc-source-trunk/gcc/cp/parser.c:10560 0x7942bc cp_parser_statement_seq_opt ../../gcc-source-trunk/gcc/cp/parser.c:10832 0x7943af cp_parser_compound_statement ../../gcc-source-trunk/gcc/cp/parser.c:10786 0x7b2c4f cp_parser_function_body ../../gcc-source-trunk/gcc/cp/parser.c:20743 0x7b2c4f cp_parser_ctor_initializer_opt_and_function_body ../../gcc-source-trunk/gcc/cp/parser.c:20779 0x7b36f1 cp_parser_function_definition_after_declarator ../../gcc-source-trunk/gcc/cp/parser.c:25475 0x7b4405 cp_parser_function_definition_from_specifiers_and_declarator ../../gcc-source-trunk/gcc/cp/parser.c:25387 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. $ ---------------------------------- void foo () { // should be e.g.: [n {0}] {}; [n {}] {}; }