summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/cxx2a-lambda-default-ctor-assign.cpp
blob: 133241bf54834e27c4052bc3e29a76c99a061c1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// RUN: %clang_cc1 -std=c++2a -verify %s

void no_capture() {
  auto x = [] {};
  decltype(x) y;
  x = x;
  x = static_cast<decltype(x)&&>(x);
}

void capture_default(int i) {
  auto x = [=] {}; // expected-note 2{{candidate constructor}} expected-note 2{{lambda expression begins here}}
  decltype(x) y; // expected-error {{no matching constructor}}
  x = x; // expected-error {{cannot be assigned}}
  x = static_cast<decltype(x)&&>(x); // expected-error {{cannot be assigned}}
}

void explicit_capture(int i) {
  auto x = [i] {}; // expected-note 2{{candidate constructor}} expected-note 2{{lambda expression begins here}}
  decltype(x) y; // expected-error {{no matching constructor}}
  x = x; // expected-error {{cannot be assigned}}
  x = static_cast<decltype(x)&&>(x); // expected-error {{cannot be assigned}}
}
OpenPOWER on IntegriCloud