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.
Confirmed with today's top of trunk (GCC 7.0). Same stack trace.
No ICE with current trunk: 68826.cc: In instantiation of 'bool requires_types(Types&& ...) [with Types = {char, int, const char (&)[3]}]': 68826.cc:10:30: required from here 68826.cc:5:19: error: 'foo' was not declared in this scope 5 | requires { foo(types); }); | ~~~^~~~~~~ 68826.cc:5:19: error: 'foo' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive] 68826.cc:5:19: error: 'foo' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
Also compiles fine since r278449. *** This bug has been marked as a duplicate of bug 68828 ***