aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/lambda-uneval21.C
blob: d3ea3acf52d42b9c8cda47a923d0cf5440d4b256 (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
// PR c++/117602
// { dg-do compile { target c++20 } }

auto x1 = [](decltype([&]{})){}; // { dg-error "non-local lambda" }

auto x2 = [&]() { // { dg-error "non-local lambda" }
     [&]() { };
};

auto x3 = []() {
     [&]() { };
};

auto x4 = []() {
     []() { };
};

auto x5 = [&]() { // { dg-error "non-local lambda" }
     []() { };
};

void
g ()
{
  [&](decltype([&](decltype([=](decltype([&](decltype([&]() {})) {})) {})) {})){};
  [&](decltype([&](decltype([&](decltype([&](decltype([&]() {})) {})) {})) {})){};
  [=](decltype([=](decltype([=](decltype([=](decltype([&]() {})) {})) {})) {})){};

  [=]() {
    [&]() { };
  };
}