PR c++/56973, DR 696 - capture constant variables only as needed.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp1y / lambda-init14.C
blobf7fffc5127dda2f91783e065a0f71ba845b339a0
1 // PR c++/69392
2 // { dg-do compile { target c++14 } }
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     }
14 int main()
16   Foo<int> f;
17   auto callable = f.getCallableFoo();
18   callable();