xref: /llvm-project/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p19.cpp (revision 1a22d2889b234fcb10cad83be231b113e6d3a8b3)
1 // RUN: %clang_cc1 -std=c++11 %s -Wunused -verify
2 
3 struct MoveOnly {
4   MoveOnly(MoveOnly&&);
5   MoveOnly(const MoveOnly&);
6 };
7 
8 template<typename T> T &&move(T&);
9 void test_special_member_functions(MoveOnly mo, int i) {
10   // FIXME: terrible note
11   auto lambda1 = [i]() { }; // expected-note{{function has been explicitly marked deleted here}} \
12   // expected-note{{the implicit copy assignment operator}} \
13   // expected-note{{the implicit move assignment operator}} \
14 
15   // Default constructor
16   decltype(lambda1) lambda2; // expected-error{{call to deleted constructor}}
17 
18   // Copy assignment operator
19   lambda1 = lambda1; // expected-error{{overload resolution selected deleted operator '='}}
20 
21   // Move assignment operator
22   lambda1 = move(lambda1);
23 
24   // Copy constructor
25   decltype(lambda1) lambda3 = lambda1;
26   decltype(lambda1) lambda4(lambda1);
27 
28   // Move constructor
29   decltype(lambda1) lambda5 = move(lambda1);
30   decltype(lambda1) lambda6(move(lambda1));
31 }
32