This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
ISO_IEC_14882-2011-5.1.2/10 - bug
- From: niXman <i dot nixman at gmail dot com>
- To: gcc at gcc dot gnu dot org
- Date: Sat, 15 Oct 2011 10:08:06 +0400
- Subject: 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.