2017-09-13 Paolo Carlini <paolo.carlini@oracle.com>
[official-gcc.git] / gcc / testsuite / g++.dg / cpp0x / lambda / lambda-this14.C
blob9834bfdb308ba22c1a7e28f8324052999a73c29e
1 // PR c++/52014
2 // { dg-require-effective-target c++11 }
4 template <class Iterator, class Func>
5 void for_each(const Iterator first, const Iterator last, Func func)
7   for (Iterator it = first; it != last; ++it) {
8     func(*it);
9   }
12 template <class T>
13 struct helper
15   typedef typename T::size_type type;
18 template <class T>
19 struct helper<T&>
21   typedef typename T::size_type type;
24 template <class T>
25 struct helper<T*>
27   typedef typename T::size_type type;
30 struct bar
32   struct foo
33   {
34     typedef int size_type;
35   } foo_;
37   void test()
38   {
39     int arr[] = { 1, 2, 3 };
40     for_each(arr, arr + 3, [&](helper<foo>::type i) {
41         for_each(arr, arr + 3, [&](helper<decltype(foo_)>::type j) { });
42       });
43   }
46 int main()
48   return 0;