1 | // RUN: %clang_cc1 -std=c++2a -verify %s |
2 | |
3 | auto a = []{}; |
4 | decltype(a) a2; |
5 | void f(decltype(a) x, decltype(a) y) { |
6 | x = y; |
7 | x = static_cast<decltype(a)&&>(y); |
8 | } |
9 | |
10 | template<typename T> |
11 | struct X { |
12 | constexpr X() { T::error; } // expected-error {{'::'}} |
13 | X(const X&); |
14 | constexpr X &operator=(const X&) { T::error; } // expected-error {{'::'}} |
15 | constexpr X &operator=(X&&) { T::error; } // expected-error {{'::'}} |
16 | }; |
17 | extern X<int> x; |
18 | auto b = [x = x]{}; // expected-note 3{{in instantiation of}} |
19 | decltype(b) b2; // expected-note {{in implicit default constructor}} |
20 | void f(decltype(b) x, decltype(b) y) { |
21 | x = y; // expected-note {{in implicit copy assignment}} |
22 | x = static_cast<decltype(b)&&>(y); // expected-note {{in implicit move assignment}} |
23 | } |
24 | |
25 | struct Y { |
26 | Y() = delete; // expected-note {{deleted}} |
27 | Y(const Y&); |
28 | Y &operator=(const Y&) = delete; // expected-note 2{{deleted}} |
29 | Y &operator=(Y&&) = delete; |
30 | }; |
31 | extern Y y; |
32 | auto c = [y = y]{}; // expected-note 3{{deleted because}} |
33 | decltype(c) c2; // expected-error {{deleted}} |
34 | void f(decltype(c) x, decltype(c) y) { |
35 | x = y; // expected-error {{deleted}} |
36 | x = static_cast<decltype(c)&&>(y); // expected-error {{deleted}} |
37 | } |
38 | |