summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/cxx2a-lambda-default-ctor-assign.cpp
blob: e555f16ecc1ec7fc021fff3c7949184f78384cac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// RUN: %clang_cc1 -std=c++2a -verify %s

auto a = []{};
decltype(a) a2;
void f(decltype(a) x, decltype(a) y) {
  x = y;
  x = static_cast<decltype(a)&&>(y);
}

template<typename T>
struct X {
  constexpr X() { T::error; } // expected-error {{'::'}}
  X(const X&);
  constexpr X &operator=(const X&) { T::error; } // expected-error {{'::'}}
  constexpr X &operator=(X&&) { T::error; } // expected-error {{'::'}}
};
extern X<int> x;
auto b = [x = x]{}; // expected-note 3{{in instantiation of}}
decltype(b) b2; // expected-note {{in implicit default constructor}}
void f(decltype(b) x, decltype(b) y) {
  x = y; // expected-note {{in implicit copy assignment}}
  x = static_cast<decltype(b)&&>(y); // expected-note {{in implicit move assignment}}
}

struct Y {
  Y() = delete; // expected-note {{deleted}}
  Y(const Y&);
  Y &operator=(const Y&) = delete; // expected-note 2{{deleted}}
  Y &operator=(Y&&) = delete;
};
extern Y y;
auto c = [y = y]{}; // expected-note 3{{deleted because}}
decltype(c) c2; // expected-error {{deleted}}
void f(decltype(c) x, decltype(c) y) {
  x = y; // expected-error {{deleted}}
  x = static_cast<decltype(c)&&>(y); // expected-error {{deleted}}
}
OpenPOWER on IntegriCloud