PR c++/56973, DR 696 - capture constant variables only as needed.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp0x / lambda / lambda-this18.C
blobfec2da615b67ba0ffe54c1c65cd3359d268412e5
1 // PR c++/61151
2 // { dg-do compile { target c++11 } }
4 struct B
6   void foo () {}
7 };
9 template <class>
10 struct A
12   template <class> void bar ();
13   B a;
16 template <class T>
17 template <class U>
18 void
19 A<T>::bar ()
21   auto f = [this] () { auto g = [=] () { a.foo (); }; g (); };
22   f ();
25 int
26 main ()
28   A<int> a;
29   a.bar <int> ();