$ g++ test.cpp -o test
test.cpp: In function ‘int main()’:
test.cpp:6:7: error: ‘basicLambda’ does not name a type
  auto basicLambda = [] { cout << "Hello, world!" << endl; };
test.cpp:7:14: error: ‘basicLambda’ was not declared in this scope
  basicLambda();

经过查询,发现 gcc 是 4.8.4 版本,应该是默认不开启,但是可以通过添加编译参数 -std=c++11 解决问题,

$ g++ test.cpp --std=c++11 -o test
$ ./test
Hello, world!