Why type const double is not captured by lambda from reaching-scope, but const int is?
问题 I seem can't understand why the following code with type const int compiles: int main() { using T = int; const T x = 1; auto lam = [] (T p) { return x+p; }; } $ clang++ -c lambda1.cpp -std=c++11 $ while this one with type const double doesn't: int main() { using T = double; const T x = 1.0; auto lam = [] (T p) { return x+p; }; } $ clang++ -c lambda2.cpp -std=c++11 lambda1.cpp:5:32: error: variable 'x' cannot be implicitly captured in a lambda with no capture-default specified auto lam = [] (T