#include <functional>
#include <iostream>
using namespace std;
struct Gadget
{
void operator()(){}
~Gadget(){ cout << "~" << endl; }
};
struct Widget
{
Gadget x;
function<void()> operator()()
{
return [=]{ x(); cout << "lambda" << endl; };
}
};
int main()
{
auto &&x = Widget{}();
x();
}
I2luY2x1ZGUgPGZ1bmN0aW9uYWw+CiNpbmNsdWRlIDxpb3N0cmVhbT4KCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgpzdHJ1Y3QgR2FkZ2V0CnsKICAgIHZvaWQgb3BlcmF0b3IoKSgpe30KICAgIH5HYWRnZXQoKXsgY291dCA8PCAifiIgPDwgZW5kbDsgfQp9OwoKc3RydWN0IFdpZGdldAp7CiAgICBHYWRnZXQgeDsKICAgIGZ1bmN0aW9uPHZvaWQoKT4gb3BlcmF0b3IoKSgpCiAgICB7CiAgICAgICAgcmV0dXJuIFs9XXsgeCgpOyBjb3V0IDw8ICJsYW1iZGEiIDw8IGVuZGw7IH07CiAgICB9Cn07CmludCBtYWluKCkKewogICBhdXRvICYmeCA9IFdpZGdldHt9KCk7CiAgIHgoKTsKfQ==