First pass of semantic analysis for init-captures: check the initializer, build
a FieldDecl from it, and propagate both into the closure type and the
LambdaExpr.

You can't do much useful with them yet -- you can't use them within the body
of the lambda, because we don't have a representation for "the this of the
lambda, not the this of the enclosing context". We also don't have support or a
representation for a nested capture of an init-capture yet, which was intended
to work despite not being allowed by the current standard wording.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181985 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Parser/cxx0x-lambda-expressions.cpp b/test/Parser/cxx0x-lambda-expressions.cpp
index d7dc7d3..76c1e0e 100644
--- a/test/Parser/cxx0x-lambda-expressions.cpp
+++ b/test/Parser/cxx0x-lambda-expressions.cpp
@@ -54,16 +54,16 @@
   void init_capture() {
     // FIXME: These diagnostics should all disappear once semantic analysis
     // for init-captures is complete.
-    [n(0)] () -> int { return ++n; }; // expected-error {{not supported}} expected-error {{undeclared}}
-    [n{0}] { return; }; // expected-error {{not supported}}
-    [n = 0] { return ++n; }; // expected-error {{not supported}} expected-error {{undeclared}}
-    [n = {0}] { return; }; // expected-error {{not supported}}
-    [a([&b = z]{})](){}; // expected-error 2{{not supported}}
+    [n(0)] () -> int { return ++n; }; // expected-error {{non-static data member}}
+    [n{0}] { return; }; // expected-error {{<initializer_list>}}
+    [n = 0] { return ++n; }; // expected-error {{non-static data member}}
+    [n = {0}] { return; }; // expected-error {{<initializer_list>}}
+    [a([&b = z]{})](){};
 
-    int x = 4; // expected-note {{here}}
-    auto y = [&r = x, x = x + 1]() -> int { // expected-error 2{{not supported}} expected-note {{here}}
-      r += 2; // expected-error {{undeclared}}
-      return x + 2; // expected-error {{implicitly captured}}
+    int x = 4;
+    auto y = [&r = x, x = x + 1]() -> int {
+      r += 2; // expected-error {{non-static data member}}
+      return x + 2; // expected-error {{non-static data member}}
     } ();
   }
 };