summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/opt/pr69432.C
blob: d024ece4cbacc968b781e787ce13ca9fb16f35c3 (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
50
51
52
53
54
55
56
57
58
59
60
61
62
// PR target/69432
// { dg-do compile }
// { dg-options "-O3" }
// { dg-additional-options "-minline-stringops-dynamically" { target i?86-*-* x86_64-*-* } }

template <typename S, typename T, typename U>
void
f1 (S x, T y, U z)
{
  for (; y; --y, ++x)
    *x = z;
}

template <typename S, typename T, typename U>
void f2 (S x, T y, U z)
{
  f1 (x, y, z);
}

struct A {};
struct B { static char f3 (A, unsigned); };

template <typename S, typename U>
void f4 (S, U);

struct C
{
  template <typename S, typename T, typename U>
  static S f5 (S x, T y, U z) { f2 (x, y, z); return S(); }
};

template <typename S, typename T, typename U>
void f6 (S x, T y, U z) { C::f5 (x, y, z); }

template <typename S, typename T, typename U, typename V>
void f7 (S x, T y, U z, V) { f6 (x, y, z); }

struct E
{
  struct D : A { char e; D (A); };
  A f;
  E (int x) : g(f) { f8 (x); }
  ~E ();
  D g;
  void f9 (int x) { x ? B::f3 (g, x) : char (); }
  void f8 (int x) { f9 (x); }
};

struct F : E
{
  F (int x) : E(x) { f10 (x); f4 (this, 0); }
  char h;
  void f10 (int x) { f7 (&g.e, x, h, 0); }
};

long a;

void
test ()
{
  F b(a);
}