We know that in C++, lambda expressions can capture local variables either by-copy (value) or by-reference, but why can I capture a variable which is not declared anywhere (not in enclosing scope)? How do standards define this behavior and what's the motivation behind this choice?
#include <iostream>
using namespace std;
int main()
{
[pi=3.14]() mutable {
pi = 3.1415926;
cout << pi << endl;
}();
}