https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66672
Henry Cooney <hacoo36 at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hacoo36 at gmail dot com --- Comment #1 from Henry Cooney <hacoo36 at gmail dot com> --- I tested this behavior as of g++ 7.2.0; is_same<decltype((j)), ...> still seems to indicate that j is an int& inside the lambda. I think this behavior is probably incorrect WRT the language spec. For example, the following code produces a compile-time error ('assignment of read-only variable 'j''): ==== int main() { int i = 100; int &j = i; cout << j; [=]() { cout << is_same<decltype((j)), int &>::value << is_same<decltype((j)), int const&>::value; cout << endl; j = j + 1; }(); cout << j; } ==== That suggests that the correct type of j is indeed int const&, not int&!