aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp23/explicit-obj-lambda4.C
blob: 6ce42ebefa8f9f101c5f6f207edc437fca4e1d50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// P0847R7
// { dg-do run { target c++23 } }

// calls to call operator of a lambda with captures with an implicit object argument
// that derives from the lambda closure object

template<typename T>
struct S : T {
    using T::operator();
};

template<typename T>
S(T) -> S<T>; 

int main()
{
  static constexpr int magic = 42;
  int n = magic;
  S s{[n](this auto&&){return n;}};
  if (s () != magic)
    __builtin_abort ();
}