gcc/testsuite/g++.dg/cpp0x/pr82878.C
raw| 1 | // { dg-do compile { target c++11 } } |
| 2 | // { dg-additional-options "-O" } |
| 3 | // pr 82878 erroneously unwrapped a reference parm in the lambda::_FUN |
| 4 | // thunk. |
| 5 | |
| 6 | struct A { |
| 7 | ~A(); |
| 8 | operator int (); |
| 9 | }; |
| 10 | |
| 11 | void baz (); |
| 12 | |
| 13 | void |
| 14 | bar (A b) |
| 15 | { |
| 16 | void (*lam) (A) = [](A) { baz (); }; |
| 17 | |
| 18 | if (auto c = b) |
| 19 | lam (c); |
| 20 | } |