https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68464
Bug ID: 68464 Summary: ICE in constexpr function: ../../src/gcc/tree.c:11497 Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ryan.burn at gmail dot com Target Milestone: --- The below code produces this ICE: rnburn@localhost ~/bugs/constexprice $ g++ -std=c++1z main.cpp main.cpp: In function ‘constexpr std::array<double, 3ul> f(int, int, int)’: main.cpp:12:12: in constexpr expansion of ‘increment(std::get<2ul, double, 3ul>(#‘result_decl’ not supported by dump_expr#<expression error>))’ main.cpp:14:1: internal compiler error: Segmentation fault } ^ 0xcf834f crash_signal ../../src/gcc/toplev.c:334 0x831ef8 cxx_eval_constant_expression ../../src/gcc/cp/constexpr.c:3180 0x835198 cxx_eval_component_reference ../../src/gcc/cp/constexpr.c:1880 0x831fd2 cxx_eval_constant_expression ../../src/gcc/cp/constexpr.c:3521 0x831515 cxx_eval_array_reference ../../src/gcc/cp/constexpr.c:1767 0x831515 cxx_eval_constant_expression ../../src/gcc/cp/constexpr.c:3506 0x830985 cxx_eval_constant_expression ../../src/gcc/cp/constexpr.c:3349 0x8306be cxx_eval_increment_expression ../../src/gcc/cp/constexpr.c:2886 0x8306be cxx_eval_constant_expression ../../src/gcc/cp/constexpr.c:3627 0x83138a cxx_eval_constant_expression ../../src/gcc/cp/constexpr.c:3570 0x830985 cxx_eval_constant_expression ../../src/gcc/cp/constexpr.c:3349 0x830985 cxx_eval_constant_expression ../../src/gcc/cp/constexpr.c:3349 0x82fdfd cxx_eval_call_expression ../../src/gcc/cp/constexpr.c:1396 0x831222 cxx_eval_constant_expression ../../src/gcc/cp/constexpr.c:3238 0x8365db cxx_eval_outermost_constant_expr ../../src/gcc/cp/constexpr.c:3773 0x8380e0 maybe_constant_value_1 ../../src/gcc/cp/constexpr.c:3960 0x8380e0 maybe_constant_value(tree_node*, tree_node*) ../../src/gcc/cp/constexpr.c:3981 0x817cc2 cp_fold ../../src/gcc/cp/cp-gimplify.c:2149 0x818400 cp_fold_r ../../src/gcc/cp/cp-gimplify.c:932 0xfa01f2 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*), void*, hash_set<tree_node*, default_hash_traits<tree_node*> >*, tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*, hash_set<tree_node*, default_hash_traits<tree_node*> >*)) ../../src/gcc/tree.c:11497 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. /////////////////////////////////////////////////////////////// #include <array> constexpr void increment(double& x) { ++x; } constexpr std::array<double, 3> f(int a, int b, int c) { std::array<double, 3> r = {}; std::get<0>(r) = a; std::get<1>(r) = b; std::get<2>(r) = c; increment(std::get<2>(r)); return r; } int main() { return 0; } ///////////////////////////////////////////////////////////////