Debian Codegraph @

gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this14.C

raw
1 // PR c++/52014
2 // { dg-require-effective-target c++11 }
3
4 template <class Iterator, class Func>
5 void for_each(const Iterator first, const Iterator last, Func func)
6 {
7 for (Iterator it = first; it != last; ++it) {
8 func(*it);
9 }
10 }
11
12 template <class T>
13 struct helper
14 {
15 typedef typename T::size_type type;
16 };
17
18 template <class T>
19 struct helper<T&>
20 {
21 typedef typename T::size_type type;
22 };
23
24 template <class T>
25 struct helper<T*>
26 {
27 typedef typename T::size_type type;
28 };
29
30 struct bar
31 {
32 struct foo
33 {
34 typedef int size_type;
35 } foo_;
36
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 }
44 };
45
46 int main()
47 {
48 return 0;
49 }