https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83115
Bug ID: 83115 Summary: Capturing the local variable/function parameter by value generates an compilation error Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: alexandr.kolesov at gmail dot com Target Milestone: --- // This simple code cannot be compiled in some cases: #include <iostream> #include <chrono> void doSomething(const double value) { [ now = std::chrono::system_clock::now(), value]{}(); // Error // [ now = std::chrono::system_clock::now(), value = value]{}(); // OK // [ value, now = std::chrono::system_clock::now()]{}(); // OK } int main() { doSomething(42.0); return 0; }