https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87685
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- This happens in: 943 for (lkp_iterator iter (fns); iter; ++iter) 944 if ((!id_expr || TREE_CODE (*iter) == TEMPLATE_DECL) 945 && DECL_NONSTATIC_MEMBER_FUNCTION_P (*iter)) 946 { 947 /* Found a non-static member. Capture this. */ 948 lambda_expr_this_capture (lam, true); 949 break; 950 } because it sees an OVERLOAD with both static and non-static member functions, regardless what will be actually called. Can we in this case (if there are mixed static and non-static members defer the decision whether to capture this until we know what will be called, or is that too late?