https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68826
Bug ID: 68826 Summary: [concepts] ICE in fold expression with requires Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jarrydb at cse dot unsw.edu.au Target Milestone: --- r231384 ICE in the fold expression in the following code: template <typename... Types> bool requires_types(Types&&... types) { return (true && ... && requires { foo(types); }); } void bar() { requires_types('c', 1, "hi"); } The error is: g++ -std=c++1z fold-ice1.cpp -c fold-ice1.cpp: In instantiation of ‘bool requires_types(Types&& ...) [with Types = {char, int, const char (&)[3]}]’: fold-ice1.cpp:10:30: required from here fold-ice1.cpp:5:19: internal compiler error: in tsubst_copy, at cp/pt.c:13729 requires { foo(types); }); ~~~^~~~~~~ 0x64d155 tsubst_copy ../../../src/gcc-git/gcc/cp/pt.c:13729 0x64e560 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../../src/gcc-git/gcc/cp/pt.c:16822 0x650303 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../../src/gcc-git/gcc/cp/pt.c:16312 0x6451ac tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../../src/gcc-git/gcc/cp/pt.c:15628 0x82133c tsubst_simple_requirement ../../../src/gcc-git/gcc/cp/constraint.cc:1580 0x82133c tsubst_requirement ../../../src/gcc-git/gcc/cp/constraint.cc:1636 0x82133c tsubst_requirement_body ../../../src/gcc-git/gcc/cp/constraint.cc:1659 0x82133c tsubst_requires_expr(tree_node*, tree_node*, int, tree_node*) ../../../src/gcc-git/gcc/cp/constraint.cc:1690 0x64f690 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../../src/gcc-git/gcc/cp/pt.c:16980 0x6451ac tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../../src/gcc-git/gcc/cp/pt.c:15628 0x66176b gen_elem_of_pack_expansion_instantiation ../../../src/gcc-git/gcc/cp/pt.c:10514 0x66176b tsubst_pack_expansion(tree_node*, tree_node*, int, tree_node*) ../../../src/gcc-git/gcc/cp/pt.c:10944 0x64b69c tsubst_fold_expr_pack ../../../src/gcc-git/gcc/cp/pt.c:10604 0x64b69c tsubst_binary_left_fold ../../../src/gcc-git/gcc/cp/pt.c:10661 0x64b69c tsubst_copy ../../../src/gcc-git/gcc/cp/pt.c:14303 0x650248 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../../src/gcc-git/gcc/cp/pt.c:16058 0x6451ac tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../../src/gcc-git/gcc/cp/pt.c:15628 0x644457 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../../src/gcc-git/gcc/cp/pt.c:14940 0x644f9b tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../../src/gcc-git/gcc/cp/pt.c:15116 0x641e06 instantiate_decl(tree_node*, int, bool) ../../../src/gcc-git/gcc/cp/pt.c:21780 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.