Debian Codegraph @

gcc/testsuite/g++.dg/cpp1z/class-deduction20.C

raw
1 // PR c++/77890
2 // { dg-do compile { target c++17 } }
3
4 template<class F> struct S{S(F&&f){}};
5 void f()
6 {
7 S([]{});
8 }
9
10 template <typename TF>
11 struct scope_guard : TF
12 {
13 scope_guard(TF f) : TF{f} { }
14 ~scope_guard() { (*this)(); }
15 };
16
17 void g()
18 {
19 struct K { void operator()() {} };
20 scope_guard _{K{}};
21 }