summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/lambda-expressions.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2016-11-16 00:03:24 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2016-11-16 00:03:24 +0000
commitca185797666f429f95c811f9fd19a02ab21cd465 (patch)
tree2359c48a7c85feb38d18068c7f483d36c9578a1d /clang/test/SemaCXX/lambda-expressions.cpp
parente8cc395e4f643a78f6a6122a9c13c6869091dc88 (diff)
downloadbcm5719-llvm-ca185797666f429f95c811f9fd19a02ab21cd465.tar.gz
bcm5719-llvm-ca185797666f429f95c811f9fd19a02ab21cd465.zip
PR23281: Fix implementation of DR1891 to implement the intent: that is, a
lambda-expression does not have a move-assignment operator. llvm-svn: 287057
Diffstat (limited to 'clang/test/SemaCXX/lambda-expressions.cpp')
-rw-r--r--clang/test/SemaCXX/lambda-expressions.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/lambda-expressions.cpp b/clang/test/SemaCXX/lambda-expressions.cpp
index 5fffe411178..4d06fdf0895 100644
--- a/clang/test/SemaCXX/lambda-expressions.cpp
+++ b/clang/test/SemaCXX/lambda-expressions.cpp
@@ -95,6 +95,39 @@ namespace ImplicitCapture {
}
}
+namespace SpecialMembers {
+ void f() {
+ auto a = []{}; // expected-note 2{{here}} expected-note 2{{candidate}}
+ decltype(a) b; // expected-error {{no matching constructor}}
+ decltype(a) c = a;
+ decltype(a) d = static_cast<decltype(a)&&>(a);
+ a = a; // expected-error {{copy assignment operator is implicitly deleted}}
+ a = static_cast<decltype(a)&&>(a); // expected-error {{copy assignment operator is implicitly deleted}}
+ }
+ struct P {
+ P(const P&) = delete; // expected-note {{deleted here}}
+ };
+ struct Q {
+ ~Q() = delete; // expected-note {{deleted here}}
+ };
+ struct R {
+ R(const R&) = default;
+ R(R&&) = delete;
+ R &operator=(const R&) = delete;
+ R &operator=(R&&) = delete;
+ };
+ void g(P &p, Q &q, R &r) {
+ auto pp = [p]{}; // expected-error {{deleted constructor}}
+ auto qq = [q]{}; // expected-error {{deleted function}} expected-note {{because}}
+
+ auto a = [r]{}; // expected-note 2{{here}}
+ decltype(a) b = a;
+ decltype(a) c = static_cast<decltype(a)&&>(a); // ok, copies R
+ a = a; // expected-error {{copy assignment operator is implicitly deleted}}
+ a = static_cast<decltype(a)&&>(a); // expected-error {{copy assignment operator is implicitly deleted}}
+ }
+}
+
namespace PR12031 {
struct X {
template<typename T>
OpenPOWER on IntegriCloud