blob: 40360e40694c1dc4c2c1687297d72a8d03e6f43f [file] [log] [blame]
Douglas Gregor1a22d282012-02-12 17:34:23 +00001// RUN: %clang_cc1 -std=c++11 %s -Wunused -verify
2
3struct MoveOnly {
4 MoveOnly(MoveOnly&&);
5 MoveOnly(const MoveOnly&);
6};
7
8template<typename T> T &&move(T&);
9void test_special_member_functions(MoveOnly mo, int i) {
Richard Smith80f57f62014-12-10 20:04:48 +000010 auto lambda1 = [i]() { }; // expected-note {{lambda expression begins here}} expected-note 2{{candidate}}
Douglas Gregor1a22d282012-02-12 17:34:23 +000011
12 // Default constructor
Richard Smith80f57f62014-12-10 20:04:48 +000013 decltype(lambda1) lambda2; // expected-error{{no matching constructor}}
Douglas Gregor1a22d282012-02-12 17:34:23 +000014
15 // Copy assignment operator
Richard Smithde1a4872012-12-28 12:23:24 +000016 lambda1 = lambda1; // expected-error{{copy assignment operator is implicitly deleted}}
Douglas Gregor1a22d282012-02-12 17:34:23 +000017
18 // Move assignment operator
19 lambda1 = move(lambda1);
20
21 // Copy constructor
22 decltype(lambda1) lambda3 = lambda1;
23 decltype(lambda1) lambda4(lambda1);
24
25 // Move constructor
26 decltype(lambda1) lambda5 = move(lambda1);
27 decltype(lambda1) lambda6(move(lambda1));
28}