Debian Codegraph @

gcc/testsuite/g++.target/s390/pr119834.C

raw
1 // PR target/119834
2 // { dg-do compile { target c++11 } }
3 // { dg-options "-O2 -march=z900" }
4
5 int *a;
6 struct A;
7 struct B {
8 A begin ();
9 A end ();
10 operator bool * ();
11 void operator++ ();
12 };
13 template <typename T>
14 auto operator| (int, T x) -> decltype (x (0));
15 struct A : B { bool a; };
16 struct C { A operator () (int); };
17 enum D {} d;
18 int e;
19 void foo ();
20 struct E {
21 template <typename T>
22 T *garply ()
23 {
24 if (d)
25 return 0;
26 if (e)
27 foo ();
28 return reinterpret_cast<T *> (f);
29 }
30 template <typename>
31 void bar (long x, bool)
32 {
33 if (&g - f)
34 __builtin_memset (a, 0, x);
35 f += x;
36 }
37 template <typename T>
38 T *baz (T *x, long y, bool z = true)
39 {
40 if (d)
41 return nullptr;
42 bar<T> ((char *)x + y - f, z);
43 return x;
44 }
45 template <typename T>
46 void qux (T x) { baz (x, x->j); }
47 char *f, g;
48 } *h;
49 struct F {
50 template <typename T>
51 int corge (T x) { x.freddy (this); return 0; }
52 template <typename T>
53 int boo (T x) { corge (x); return 0; }
54 } i;
55 template <typename T>
56 struct G {
57 template <typename U> friend T operator+ (U, G);
58 template <typename U>
59 void waldo (F *x, G y, U z) { x->boo (z + y); }
60 template <typename... Ts>
61 void plugh (E *y, Ts... z) { T *x = y->garply<T> (); x->thud (y, z...); }
62 };
63 template <typename T> using H = G<T>;
64 struct I {
65 static constexpr unsigned j = 2;
66 void thud (E *x, A y) { x->qux (this); for (auto g : y) ; }
67 };
68 H<I> k;
69 struct J {
70 void freddy (F *) { C a; auto b = 0 | a; k.plugh (h, b); }
71 };
72 H<J> l;
73 struct K {
74 void freddy () { l.waldo (&i, l, this); }
75 };
76 void grault () { K m; m.freddy (); }