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

// calls to (captureless) lambda with explicit object parameter of unrelated type
// with an appropriate converting constructor

inline constexpr int magic = 42;

struct S {
  int _v;  
  template<typename T>
  S(T) : _v(magic) {}
};

int main()
{
  auto f = [](this S self){ return self._v; };
  if (f () != magic)
    __builtin_abort ();
}