https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97745
Bug ID: 97745 Summary: [10 Regression] ICE in tsubst_decl, at cp/pt.c:14666 Product: gcc Version: 10.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: doko at debian dot org Target Milestone: --- https://bugs.debian.org/973698 seen with the gcc-10 branch, compiler configured with --enable-checking=yes,extra,rtl gives an error on the gcc-9 branch and trunk. $ cat search_collection_test.ii template <typename a, typename b = a> b aa; template <typename a> auto ab() -> decltype(aa<a>); # 1 "" 3 template <typename br, typename c> concept d = __is_base_of(c, br); template <typename> struct bz; struct { template <typename cb, typename... cc> auto operator()(cb e, cc... g) -> decltype(e(g...)); } bw; template <typename cd, typename... cc> using ce = decltype(bw(ab<cd>(), ab<cc>...)); namespace ch { struct cx; } template <typename cy, typename f> concept da = d<ce<cy, f>, ch::cx>; template <typename cy, typename f> concept db = da<cy, f>; struct { template <typename cd> bz<cd> operator()(cd); } dc; struct h { template <typename f, typename cy> requires db<cy, f> friend operator|(f, bz<cy>); }; template <typename> struct bz : h {}; struct { template <typename cd> auto operator()(cd e) { return dc(e); } } dm; class { count() { count | dm([*this](auto) {}) } }; $ g++ -c -std=c++17 -fconcepts -Wall search_collection_test.ii : In instantiation of ‘<unnamed class>::count()::<lambda(auto:1)> [with auto:1 = int (<unnamed class>::* (*)())()]’: :5:47: required by substitution of ‘template<class cb, class ... cc> decltype (e(._anon_0::operator()::g ...))<unnamed struct>::operator()(cb, cc ...) [with cb = <unnamed class>::count()::<lambda(auto:1)>; cc = {int (<unnamed class>::* (*)())()}]’ :8:23: required from ‘int operator|(f, bz<cy>) [with f = int (<unnamed class>::*)(); cy = <unnamed class>::count()::<lambda(auto:1)>]’ :27:32: required from here :27:28: internal compiler error: in tsubst_decl, at cp/pt.c:14666 0x6656de tsubst_decl ../../src/gcc/cp/pt.c:14666 0xc21587 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../src/gcc/cp/pt.c:18002 0xc1e8e8 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../src/gcc/cp/pt.c:18219 0xc1c831 instantiate_decl(tree_node*, bool, bool) ../../src/gcc/cp/pt.c:25824 0xb5084a maybe_instantiate_decl ../../src/gcc/cp/decl2.c:5370 0xb52f40 maybe_instantiate_decl ../../src/gcc/cp/decl2.c:5555 0xb52f40 mark_used(tree_node*, int) ../../src/gcc/cp/decl2.c:5581 0xaa4322 build_over_call ../../src/gcc/cp/call.c:9093 0xaa91b1 build_op_call_1 ../../src/gcc/cp/call.c:4872 0xaa91b1 build_op_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, int) ../../src/gcc/cp/call.c:4901 0xc64f8e finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool, bool, int) ../../src/gcc/cp/semantics.c:2689 0xc2ec88 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../src/gcc/cp/pt.c:20115 0xc30cf4 tsubst(tree_node*, tree_node*, int, tree_node*) ../../src/gcc/cp/pt.c:15946 0xc3b54a tsubst_function_type ../../src/gcc/cp/pt.c:14932 0xc308f0 tsubst(tree_node*, tree_node*, int, tree_node*) ../../src/gcc/cp/pt.c:15753 0xc3f3cc tsubst_function_decl ../../src/gcc/cp/pt.c:13787 0xc28c3f tsubst_decl ../../src/gcc/cp/pt.c:14230 0xc39569 instantiate_template_1 ../../src/gcc/cp/pt.c:20871 0xc48ecb instantiate_template(tree_node*, tree_node*, int) ../../src/gcc/cp/pt.c:20928 0xc48ecb fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node* const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool, bool) ../../src/gcc/cp/pt.c:21372 Please submit a full bug report, with preprocessed source if appropriate. $ g++-9 -c -std=c++17 -fconcepts -Wall search_collection_test.ii : In member function ‘int<unnamed class>::count()’: :27:11: error: invalid use of non-static member function ‘int<unnamed class>::count()’ :26:3: note: declared here : At global scope: :29:2: error: abstract declarator ‘<unnamed class>’ used as declaration :15:33: error: ‘bz<cd><unnamed struct>::operator()(cd) [with cd = <unnamed class>::count()::<lambda(auto:1)>]’, declared using local type ‘<unnamed class>::count()::<lambda(auto:1)>’, is used but never defined [-fpermissive] $ /usr/lib/gcc-snapshot/bin/g++ -c -std=c++17 -fconcepts -Wall search_collection_test.ii : In member function 'int<unnamed class>::count()': :27:11: error: invalid use of non-static member function 'int<unnamed class>::count()' :26:3: note: declared here : At global scope: :29:2: error: abstract declarator '<unnamed class>' used as declaration :15:33: error: 'bz<cd><unnamed struct>::operator()(cd) [with cd = <unnamed class>::count()::<lambda(auto:1)>]', declared using local type '<unnamed class>::count()::<lambda(auto:1)>', is used but never defined [-fpermissive]