aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-05-03 19:16:22 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-05-03 19:16:22 +0000
commit0f2fc5ff49cb9abd6c6972ffd6db066295672867 (patch)
treebfc41cab8354335424b7c89e9d3f8a040624e8d4 /test
parent8c045ace381972f41d385b0a661ccf172834f459 (diff)
PR15906: The body of a lambda is not an evaluated subexpression; don't visit it when visiting such subexpressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181046 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/SemaCXX/uninitialized.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/SemaCXX/uninitialized.cpp b/test/SemaCXX/uninitialized.cpp
index 2aa56623f6..665cfe7e91 100644
--- a/test/SemaCXX/uninitialized.cpp
+++ b/test/SemaCXX/uninitialized.cpp
@@ -511,3 +511,15 @@ namespace operators {
int x = x = 5;
}
+
+namespace lambdas {
+ struct A {
+ template<typename T> A(T) {}
+ int x;
+ };
+ A a0([] { return a0.x; }); // ok
+ void f() {
+ A a1([=] { return a1.x; }); // expected-warning{{variable 'a1' is uninitialized when used within its own initialization}}
+ A a2([&] { return a2.x; }); // ok
+ }
+}