https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82980
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-10 branch has been updated by Jason Merrill <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:3efc6fd0df1ce4988a1ae117d3a77134213930a3 commit r10-10726-g3efc6fd0df1ce4988a1ae117d3a77134213930a3 Author: Jason Merrill <ja...@redhat.com> Date: Thu Apr 14 08:16:45 2022 -0400 c++: lambda and the current instantiation [PR82980] When a captured variable is type-dependent, we've expressed the type of the capture field and proxy with a decltype variant. But if the type is "the current instantiation", we need to be able to see that so that we can do lookup inside it just like we could with the captured variable itself. I also tried looking through lambda capture in cp_parser_postfix_dot_deref_expression, but this way seems cleaner. I plan to treat more types as deducible in stage 1. I considered also using this in do_auto_deduction, but think that would be wrong: [temp.dep.expr] says an id-expression is type-dependent if it is "associated by name lookup with a variable declared with a type that contains a placeholder type where the initializer is type-dependent". That doesn't clearly exclude deducing a dependent type from the initializer, but it seems like a barrier, and other implementations agree. PR c++/82980 gcc/cp/ChangeLog: * lambda.c (type_deducible_expression_p): New. (lambda_capture_field_type): Check it. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/lambda/lambda-current-inst1.C: New test.