http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57515
--- Comment #1 from jos at vandenoever dot info --- The first line of the code snippet was missing: int some_list[]={ 1, 2, 3, 4, 5 }; int total = 0; std::for_each(begin(some_list), end(some_list), [&total](int x) { total += x; });