[cxx2a] P0624R2: Lambdas with no capture-default are
default-constructible and assignable.

llvm-svn: 343279
diff --git a/clang/test/SemaCXX/cxx17-compat.cpp b/clang/test/SemaCXX/cxx17-compat.cpp
index 3b81434..9d628da 100644
--- a/clang/test/SemaCXX/cxx17-compat.cpp
+++ b/clang/test/SemaCXX/cxx17-compat.cpp
@@ -27,3 +27,18 @@
     // expected-warning@-4 {{default member initializer for bit-field is incompatible with C++ standards before C++2a}}
 #endif
 };
+
+auto Lambda = []{};
+decltype(Lambda) AnotherLambda;
+#if __cplusplus <= 201703L
+    // expected-error@-2 {{no matching constructor}} expected-note@-3 2{{candidate}}
+#else
+    // expected-warning@-4 {{default construction of lambda is incompatible with C++ standards before C++2a}}
+#endif
+
+void copy_lambda() { Lambda = Lambda; }
+#if __cplusplus <= 201703L
+    // expected-error@-2 {{deleted}} expected-note@-10 {{lambda}}
+#else
+    // expected-warning@-4 {{assignment of lambda is incompatible with C++ standards before C++2a}}
+#endif
diff --git a/clang/test/SemaCXX/cxx2a-lambda-default-ctor-assign.cpp b/clang/test/SemaCXX/cxx2a-lambda-default-ctor-assign.cpp
new file mode 100644
index 0000000..e555f16
--- /dev/null
+++ b/clang/test/SemaCXX/cxx2a-lambda-default-ctor-assign.cpp
@@ -0,0 +1,37 @@
+// RUN: %clang_cc1 -std=c++2a -verify %s
+
+auto a = []{};
+decltype(a) a2;
+void f(decltype(a) x, decltype(a) y) {
+  x = y;
+  x = static_cast<decltype(a)&&>(y);
+}
+
+template<typename T>
+struct X {
+  constexpr X() { T::error; } // expected-error {{'::'}}
+  X(const X&);
+  constexpr X &operator=(const X&) { T::error; } // expected-error {{'::'}}
+  constexpr X &operator=(X&&) { T::error; } // expected-error {{'::'}}
+};
+extern X<int> x;
+auto b = [x = x]{}; // expected-note 3{{in instantiation of}}
+decltype(b) b2; // expected-note {{in implicit default constructor}}
+void f(decltype(b) x, decltype(b) y) {
+  x = y; // expected-note {{in implicit copy assignment}}
+  x = static_cast<decltype(b)&&>(y); // expected-note {{in implicit move assignment}}
+}
+
+struct Y {
+  Y() = delete; // expected-note {{deleted}}
+  Y(const Y&);
+  Y &operator=(const Y&) = delete; // expected-note 2{{deleted}}
+  Y &operator=(Y&&) = delete;
+};
+extern Y y;
+auto c = [y = y]{}; // expected-note 3{{deleted because}}
+decltype(c) c2; // expected-error {{deleted}}
+void f(decltype(c) x, decltype(c) y) {
+  x = y; // expected-error {{deleted}}
+  x = static_cast<decltype(c)&&>(y); // expected-error {{deleted}}
+}