Lambda capture dangling reference

What is the issue with the following code?

#include <functional>
std::function<int()> makeCounter() {
    int count = 0;
    return [&count]() { return ++count; };
}
int main() {
    auto f = makeCounter();
    return f();
}