gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv9.C
raw| 1 | // PR c++/65339 |
| 2 | // { dg-do compile { target c++11 } } |
| 3 | |
| 4 | class FuncWrapper { |
| 5 | public: |
| 6 | template <typename Func> void callfunc(Func f) |
| 7 | { |
| 8 | f(); |
| 9 | } |
| 10 | }; |
| 11 | |
| 12 | class Object { |
| 13 | int field; |
| 14 | public: |
| 15 | void Method(); |
| 16 | Object() { field = 555; } |
| 17 | Object(const Object&) { __builtin_abort(); } |
| 18 | }; |
| 19 | |
| 20 | void Object::Method () |
| 21 | { |
| 22 | FuncWrapper wrap; |
| 23 | wrap.callfunc(*[]() |
| 24 | { |
| 25 | return Object(); |
| 26 | }); |
| 27 | } |