blob: 41507e2b8378e5a36da6429a87f45e2fbb6d167b [file] [log] [blame]
// { dg-do compile { target c++14 } }
#include <iostream>
auto lol()
{
int aha = 3;
return [&aha] { // { dg-warning "dereferencing pointer '.*' to within stale stack frame" }
return aha;
};
/* TODO: may be worth special-casing the reporting of dangling
references from lambdas, to highlight the declaration, and maybe fix
the wording (it's a reference, not a pointer, for one thing). */
}
int main()
{
auto lambda = lol();
std::cout << lambda() << std::endl;
return 0;
}