https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77545
Bug ID: 77545 Summary: ICE on valid C++11 code: in potential_constant_expression_1, at cp/constexpr.c:5480 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 $ clang++-3.8 -c -std=c++11 small.cpp $ $ g++-trunk -c small.cpp small.cpp: In function ‘void f(A<int>)’: small.cpp:10:35: sorry, unimplemented: unexpected AST of kind cleanup_stmt for (auto x : (A < int >[]) { a }) ^ small.cpp:10:35: internal compiler error: in potential_constant_expression_1, at cp/constexpr.c:5480 0x8c1357 potential_constant_expression_1 ../../gcc-source-trunk/gcc/cp/constexpr.c:5480 0x8c1227 potential_constant_expression_1 ../../gcc-source-trunk/gcc/cp/constexpr.c:5039 0x8c0511 potential_constant_expression_1 ../../gcc-source-trunk/gcc/cp/constexpr.c:5399 0x8c1ed3 potential_constant_expression ../../gcc-source-trunk/gcc/cp/constexpr.c:5491 0x8c1ed3 potential_nondependent_constant_expression(tree_node*) ../../gcc-source-trunk/gcc/cp/constexpr.c:5533 0x8c2f62 maybe_constant_value_1 ../../gcc-source-trunk/gcc/cp/constexpr.c:4574 0x8c2f62 maybe_constant_value(tree_node*, tree_node*) ../../gcc-source-trunk/gcc/cp/constexpr.c:4608 0x89e941 cp_fully_fold(tree_node*) ../../gcc-source-trunk/gcc/cp/cp-gimplify.c:1971 0x733375 store_init_value(tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed>**, int) ../../gcc-source-trunk/gcc/cp/typeck2.c:829 0x68ea5c check_initializer ../../gcc-source-trunk/gcc/cp/decl.c:6230 0x6b91fd cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int) ../../gcc-source-trunk/gcc/cp/decl.c:6888 0x78fbc2 cp_convert_range_for(tree_node*, tree_node*, tree_node*, bool) ../../gcc-source-trunk/gcc/cp/parser.c:11451 0x7bfeb0 cp_parser_range_for ../../gcc-source-trunk/gcc/cp/parser.c:11335 0x7bfeb0 cp_parser_for ../../gcc-source-trunk/gcc/cp/parser.c:11236 0x7bfeb0 cp_parser_iteration_statement ../../gcc-source-trunk/gcc/cp/parser.c:11735 0x7b5b79 cp_parser_statement ../../gcc-source-trunk/gcc/cp/parser.c:10448 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 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. $ -------------------------------------------- template < typename T > struct A { A (); ~A (); T t; }; void f (A < int > a) { for (auto x : (A < int >[]) { a }) ; }