diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-11-16 00:03:24 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-11-16 00:03:24 +0000 |
commit | ca185797666f429f95c811f9fd19a02ab21cd465 (patch) | |
tree | 2359c48a7c85feb38d18068c7f483d36c9578a1d /clang/test/SemaCXX/lambda-expressions.cpp | |
parent | e8cc395e4f643a78f6a6122a9c13c6869091dc88 (diff) | |
download | bcm5719-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.cpp | 33 |
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> |