[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / SemaCXX / cxx2a-lambda-default-ctor-assign.cpp
blob133241bf54834e27c4052bc3e29a76c99a061c1f
1 // RUN: %clang_cc1 -std=c++2a -verify %s
3 void no_capture() {
4 auto x = [] {};
5 decltype(x) y;
6 x = x;
7 x = static_cast<decltype(x)&&>(x);
10 void capture_default(int i) {
11 auto x = [=] {}; // expected-note 2{{candidate constructor}} expected-note 2{{lambda expression begins here}}
12 decltype(x) y; // expected-error {{no matching constructor}}
13 x = x; // expected-error {{cannot be assigned}}
14 x = static_cast<decltype(x)&&>(x); // expected-error {{cannot be assigned}}
17 void explicit_capture(int i) {
18 auto x = [i] {}; // expected-note 2{{candidate constructor}} expected-note 2{{lambda expression begins here}}
19 decltype(x) y; // expected-error {{no matching constructor}}
20 x = x; // expected-error {{cannot be assigned}}
21 x = static_cast<decltype(x)&&>(x); // expected-error {{cannot be assigned}}