Подтвердить что ты не робот

Что GCC делает с моей статической переменной в лямбда?

Используя GCC 6.1, следующая программа:

#include <string>
#include <vector>
#include <iterator>
#include <algorithm>
#include <iostream>

int main()
{
    static const std::string foo {"foo"};
    std::vector<std::string> bars {{""}};
    std::cout << "foo outside: " << foo << std::endl;
    std::for_each(std::cbegin(bars), std::cend(bars), [] (const auto& bar) {
        std::cout << "foo inside: " << foo << std::endl;
    });
}

Печать

foo outside: foo
foo inside: 

Live On Coliru

Что происходит?

4b9b3361