summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/torture/pr42760.C
blob: be85f7fc4085570ea71c7f6b3c23a6032e793e27 (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
// PR middle-end/42760
// { dg-do compile }

template <typename T>
struct A
{
  static T b (T it) { return it; }
};

template <typename T, typename U>
static U
baz (T x, T y, U z)
{
  for (long n = y - x; n > 0; --n)
    {
      *z = *x;
      ++z;
    }
};

template <typename T, typename U>
U
bar (T x, T y, U z)
{
  baz (A <T>::b (x), A <T>::b (y), A <U>::b (z));
}

struct C
{
  __complex__ float v;
};

template <class T>
struct B
{
  B (T y[]) { bar (y, y + 1, x); }
  operator T *() { return x; }
  T x[1];
};

B <C>
foo ()
{
  C y[1];
  return B <C> (y);
};