template<typename Key> class trie { static void for_each(int & f, trie const & n, Key & prefix) { [&](trie const & c) { for_each(f, c, prefix); }; } void for_each(int & f) const { } }; --- $ g++ foo.h foo.h: In lambda function: foo.h:5:32: error: ‘this’ was not captured for this lambda function for_each(f, c, prefix); Works fine in 7.3. Also works after removing the lambda (i.e. the overload is resolved correctly) or the template.
Author: jason Date: Sat Jun 2 03:14:44 2018 New Revision: 261101 URL: https://gcc.gnu.org/viewcvs?rev=261101&root=gcc&view=rev Log: PR c++/85764 - bogus 'this' not captured error. * lambda.c (resolvable_dummy_lambda): Use nonlambda_method_basetype. (nonlambda_method_basetype): Handle NSDMI. Added: trunk/gcc/testsuite/g++.dg/cpp1y/lambda-generic-this2.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/lambda.c
Author: jason Date: Mon Jun 11 22:02:07 2018 New Revision: 261462 URL: https://gcc.gnu.org/viewcvs?rev=261462&root=gcc&view=rev Log: PR c++/85764 - bogus 'this' not captured error. * lambda.c (resolvable_dummy_lambda): Use nonlambda_method_basetype. (nonlambda_method_basetype): Handle NSDMI. Added: branches/gcc-8-branch/gcc/testsuite/g++.dg/cpp1y/lambda-generic-this2.C Modified: branches/gcc-8-branch/gcc/cp/ChangeLog branches/gcc-8-branch/gcc/cp/lambda.c
Fixed for 8.2.