aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp23/explicit-obj-lambda16.C
blob: 69936388969cc2df79f60ddda00017af2bddcfe7 (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
38
39
// PR c++/113563
// { dg-do compile { target c++23 } }

struct S {
  int x_;
  void f() {
    [this](this auto) {
      this->x_ = 42;
      return this;
    }();
  }
};

struct R {
  int x;

  auto foo() {
    return [*this](this auto &self) {
      this->x = 4;
    };
  }
};


struct A
{
    int n;
    void fun()
    {
        auto _ = [&](this auto self) { return n; };
    }
};

struct B {
  int i = 42;
  int foo() {
    return [this](this auto &&self) { auto p = &i; return *p; }();
  }
};