aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this14.C
blob: 9834bfdb308ba22c1a7e28f8324052999a73c29e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// PR c++/52014
// { dg-require-effective-target c++11 }

template <class Iterator, class Func>
void for_each(const Iterator first, const Iterator last, Func func)
{
  for (Iterator it = first; it != last; ++it) {
    func(*it);
  }
}

template <class T>
struct helper
{
  typedef typename T::size_type type;
};

template <class T>
struct helper<T&>
{
  typedef typename T::size_type type;
};

template <class T>
struct helper<T*>
{
  typedef typename T::size_type type;
};

struct bar
{
  struct foo
  {
    typedef int size_type;
  } foo_;

  void test()
  {
    int arr[] = { 1, 2, 3 };
    for_each(arr, arr + 3, [&](helper<foo>::type i) {
	for_each(arr, arr + 3, [&](helper<decltype(foo_)>::type j) { });
      });
  }
};

int main()
{
  return 0;
}