prog.cpp: In lambda function:
prog.cpp:10:21: error: ‘n’ is not captured
[] { std::cout<<n<<std::endl; }(); // error: 'n' is not captured
^
prog.cpp:10:6: note: the lambda has no capture-default
[] { std::cout<<n<<std::endl; }(); // error: 'n' is not captured
^
prog.cpp:9:15: note: ‘const int n’ declared here
const int n = std::rand();
^