gcc/testsuite/g++.dg/cpp1y/lambda-init14.C
raw| 1 | // PR c++/69392 |
| 2 | // { dg-do compile { target c++14 } } |
| 3 | |
| 4 | template <typename T> |
| 5 | class Foo { |
| 6 | public: |
| 7 | void foo(void) {} |
| 8 | auto getCallableFoo(void) { |
| 9 | return |
| 10 | [ptr = this]() { ptr->foo(); }; |
| 11 | } |
| 12 | }; |
| 13 | |
| 14 | int main() |
| 15 | { |
| 16 | Foo<int> f; |
| 17 | auto callable = f.getCallableFoo(); |
| 18 | callable(); |
| 19 | } |