This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

ISO_IEC_14882-2011-5.1.2/10 - bug


Hello.

Quote from ISO_IEC_14882-2011, 5.1.2/10:
> The identifiers in a capture-list are looked up using the usual rules for unqualified name lookup (3.4.1); each
> such lookup shall find a variable with automatic storage duration declared in the reaching scope of the local
> lambda expression. An entity (i.e. a variable or this) is said to be explicitly captured if it appears in the
> lambda-expressionâs capture-list.

But this code successfuly compiled on gcc-4.6.1:
#include <iostream>
int main() {
   using std::cout;
   auto f = [&cout]() { cout << 1; }; // <<
   f();
}

http://liveworkspace.org/code/ae698b7daf7b5b531beafd9faaa6a409


But Intel C++ 12.1 says: error : a variable with static storage
duration cannot be captured in a lambda


Thanks.
   niXman.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]