Debian Codegraph @

gcc/testsuite/g++.dg/cpp1y/lambda-generic-86875.C

raw
1 // PR c++/86875
2 // { dg-do compile { target c++14 } }
3
4 template <typename _Tp> using decay_t = _Tp;
5 template <class Fun> class A {
6 Fun fun_;
7
8 public:
9 template <class T> A(T p1) : fun_(p1) {}
10 auto operator()() { fun_(this); }
11 };
12
13 template <class Fun> auto y_combinator(Fun p1) { return A<decay_t<Fun>>(p1); }
14
15 int
16 main()
17 {
18 const unsigned int w = 1;
19 auto foo = y_combinator([=](auto) { auto i = +w; });
20 foo();
21 }