https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106351
Bug ID: 106351 Summary: ICE in fold expression involving templatized lambda Product: gcc Version: 12.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: amir.ahmed.ansari at outlook dot com Target Milestone: --- The following code: template <typename ...Args> struct C { void f() { ( [&, this]<typename Arg>() { }.operator()<Args>(), ... ); } }; int main() { C<int>{}.f(); return 0; } produces: <source>: In instantiation of 'void C<Args>::f() [with Args = {int}]': <source>:17:15: required from here <source>:9:30: internal compiler error: in lookup_template_class_1, at cp/pt.cc:10114 7 | [&, this]<typename Arg>() | ~~~~~~~~~~~~~~~~~~~~~~~~~ 8 | { | ~ 9 | }.operator()<Args>(), | ~~~~~~~~~~~~~~~~~^ 0x1ba65f9 internal_error(char const*, ...) ???:0 0x6fad32 fancy_abort(char const*, int, char const*) ???:0 0x87f6fd lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*, int, int) ???:0 0x875d31 tsubst(tree_node*, tree_node*, int, tree_node*) ???:0 0x881224 tsubst_pack_expansion(tree_node*, tree_node*, int, tree_node*) ???:0 0x878889 instantiate_decl(tree_node*, bool, bool) ???:0 0x8936ab instantiate_pending_templates(int) ???:0 0x79c46d c_parse_final_cleanups() ???:0 Please submit a full bug report, with preprocessed source (by using -freport-bug). Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. ASM generation compiler returned: 1