| 1 |
// PR c++/89419 |
| 2 |
// { dg-do compile { target c++14 } } |
| 3 |
|
| 4 |
struct A; |
| 5 |
struct B { // { dg-error "cannot bind" "" { target c++23 } } |
| 6 |
struct C { C (); C (C &); } b; |
| 7 |
}; |
| 8 |
struct D { A operator* (); }; |
| 9 |
struct A { |
| 10 |
template <typename T> void foo (T x) { x (this); } |
| 11 |
}; |
| 12 |
struct E { |
| 13 |
auto bar () { return e; } |
| 14 |
D e; |
| 15 |
}; |
| 16 |
struct F { B f; int g; }; // { dg-error "use of deleted function" "" { target c++23 } } |
| 17 |
|
| 18 |
int |
| 19 |
main () |
| 20 |
{ |
| 21 |
E e; |
| 22 |
auto f = *e.bar (); |
| 23 |
auto i = [&] { F g; g.g = 1; auto h = [&](auto) { g.g = 0; }; f.foo (h); return g; }; // { dg-error "use of deleted function" "" { target c++23 } } |
| 24 |
} |