Douglas Gregor f02455e5ee Add various tests for captures and the reaching scope of the lambda
expression. Implement C++11 [expr.prim.lambda]p12's requirement that
capturing a variable will odr-use it.

llvm-svn: 150237
2012-02-10 09:26:04 +00:00

17 lines
423 B
C++

// RUN: %clang_cc1 -std=c++11 %s -verify
void test_reaching_scope() {
int local; // expected-note{{declared here}}
static int local_static;
(void)[=]() {
struct InnerLocal {
void member() {
(void)[=]() {
return local + // expected-error{{reference to local variable 'local' declared in enclosing function 'test_reaching_scope'}}
local_static;
};
}
};
};
}