aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp23/explicit-obj-lambda14.C
blob: 5c1d566f93611ceaf83e85979a24f7f499049dac (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
// PR c++/113640
// { dg-do run { target c++23 } }

static int total;

struct A {
  A f(this auto self, int n) {
    total += n;
    return self;
  }
};

int main() {
  A a;
  a.f(1).f(42).f(100);
  if (total != 143)
    __builtin_abort();

  auto l = [](this auto self, int n) {
    total += n;
    return self;
  };
  total = 0;
  l(1)(42)(100);
  if (total != 143)
    __builtin_abort();
}