https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68828
Bug ID: 68828 Summary: [concepts] ICE in fold with requires and function call around parameters 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: --- The following causes r231384 to ICE template <typename... Types> struct Var { }; struct A { }; template <typename T> T forward(T t) { return static_cast<T>(t); } template <typename V, typename... Types, typename... Args> bool requires_types_args(V&& v, Var<Types...>&, Args&&... args) { return (true && ... && requires (V&& v, Types type, Args... args) { foo(forward<V>(v), forward<Types>(type), forward<Args>(args)...); } ); } void bar() { Var<int, char> v; requires_types_args(A(), v, 1, 'b'); } Error is: g++ -std=c++1z fold-ice3.cpp fold-ice3.cpp: In instantiation of ‘bool requires_types_args(V&&, Var<Types ...>&, Args&& ...) [with V = A; Types = int, char; Args = {int, char}]’: fold-ice3.cpp:31:37: required from here fold-ice3.cpp:22:10: error: ‘foo’ was not declared in this scope foo(forward<V>(v), forward<Types>(type), ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ forward<Args>(args)...); ~~~~~~~~~~~~~~~~~~~~~~~ fold-ice3.cpp:22:10: error: ‘foo’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive] fold-ice3.cpp:22:10: note: ‘foo’ declared here, later in the translation unit fold-ice3.cpp:26:1: internal compiler error: tree check: expected tree that contains ‘typed’ structure, have ‘simple_req’ in cp_fold, at cp/cp-gimplify.c:1948 } ^ 0xf62e24 tree_contains_struct_check_failed(tree_node const*, tree_node_structure_enum, char const*, int, char const*) ../../../src/gcc-git/gcc/tree.c:9771 0x7f610c contains_struct_check(tree_node*, tree_node_structure_enum, char const*, int, char const*) ../../../src/gcc-git/gcc/tree.h:3111 0x7f610c cp_fold ../../../src/gcc-git/gcc/cp/cp-gimplify.c:1948 0x7f6620 cp_fold_r ../../../src/gcc-git/gcc/cp/cp-gimplify.c:941 0xf85d82 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-git/gcc/tree.c:11492 0xf85ecd 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-git/gcc/tree.c:11539 0x79fb18 cp_walk_subtrees(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*, hash_set<tree_node*, default_hash_traits<tree_node*> >*) ../../../src/gcc-git/gcc/cp/tree.c:3895 0xf85df8 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-git/gcc/tree.c:11515 0xf861d6 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-git/gcc/tree.c:11809 0x612eaf finish_function(int) ../../../src/gcc-git/gcc/cp/decl.c:14589 0x641eaf instantiate_decl(tree_node*, int, bool) ../../../src/gcc-git/gcc/cp/pt.c:21802 0x687c7b instantiate_pending_templates(int) ../../../src/gcc-git/gcc/cp/pt.c:21897 0x6c8ef1 c_parse_final_cleanups() ../../../src/gcc-git/gcc/cp/decl2.c:4579 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.