I\'m trying to compile the following code with GCC 4.7.2:
#include 
int foo() {
    static int bar;
    return [&b         
         
Per the standard, you can only capture variables with automatic storage duration (or this, which is mentioned as explicitly capturable).
So, no, you can't do that as per the standard (or, to answer your first question, that is not valid C++ 11 and is not a compiler bug)
5.1.1/2 A name in the lambda-capture shall be in scope in the context of the lambda expression, and shall be this or refer to a local variable or reference with automatic storage duration.
EDIT: And, as Kevin mentioned, you don't even need to capture a local static anyways.