On 2015-04-18 18:53, Adam Butcher wrote:
Test like this?
/* { dg-do run { target c++14 } } */
/* { dg-final { scan-assembler-not "..." } } */
struct X
{
int f (int, double) { return 255; }
static int f (int, int) { return 65535; }
auto m1 ()
{
return [=] (auto a) {
return f (7, a);
};
}
auto m2 ()
{
return [=] (auto a) {
return f (9, 10) + a;
};
}
And this:
auto m3 ()
{
return [=] (auto a) {
return f (11, 12.0) + a;
};
}
Currently we don't capture 'this' here despite the call not being
dependent on any lambda parameter and resolving to a non-static member
function.
I think I need to resolve a member call within a generic lambda as if
it were not in template context to determine whether it unambiguously
resolves to a static member function. If it does, then no capture
required. Otherwise, 'this' should be captured because either a) the
call is to a non-static member function without any dependent parameters
or b) because it may resolve to a non-static member function at callop
instantiate time.
No sure whether I can do all this at my current patch site in
cp_parser_postfix_expression or whether it needs to be later.
Adam