http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59070
Sarfaraz Nawaz <sir_nawaz959 at yahoo dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |NEW Resolution|WORKSFORME |--- --- Comment #4 from Sarfaraz Nawaz <sir_nawaz959 at yahoo dot com> --- Here is the complete testcase which compiles fine but gives incorrect output: #include <iostream> #include <vector> #include <string> std::ostream & operator<<(std::ostream & out, std::vector<std::string> const & items) { for(auto const & item : items ) out << item << " "; return out; } int main() { std::cout << "\nGCC " << __VERSION__ << std::endl; std::vector<std::string> items {"default"}; auto add = [=](std::string item) mutable { items.push_back(item); return items; } ; std::cout << add("one") << std::endl; std::cout << add("two") << std::endl; std::cout << add("three") << std::endl; } $ g++-4.8 -std=c++11 -O2 -Wall -pedantic-errors main.cpp && ./a.out GCC 4.8.1 default one two three which is incorrect output