145
|
1 // PR tree-optimization/92262
|
|
2 // { dg-do compile { target c++11 } }
|
|
3 // { dg-options "-O2 -ftree-loop-distribution -g" }
|
|
4
|
|
5 struct A;
|
|
6 struct B { template <typename T> using b = T *; };
|
|
7 template <typename, typename T> using c = B::b<T>;
|
|
8 void *operator new (__SIZE_TYPE__, void *p) { return p; }
|
|
9 struct C {
|
|
10 template <typename T, typename... U> void
|
|
11 foo (T *x, U... y) { new (x) T(y...); }
|
|
12 };
|
|
13 template <typename> class D : public C {};
|
|
14 template <typename> struct E;
|
|
15 template <typename T> struct E<D<T>> {
|
|
16 using e = D<T>;
|
|
17 template <typename U> using f = D<U>;
|
|
18 template <typename U, typename... V>
|
|
19 static void
|
|
20 bar (e x, U y, V... z) { x.foo (y, z...); }
|
|
21 };
|
|
22 template <typename T> struct F : E<T> {
|
|
23 template <typename U> struct G { typedef typename E<T>::template f<U> O; };
|
|
24 };
|
|
25 template <typename T, typename U, typename V> void
|
|
26 baz (T x, U y, V z)
|
|
27 {
|
|
28 F<V>::bar (z, y, *x);
|
|
29 }
|
|
30 struct H {
|
|
31 typedef c<int, A> I;
|
|
32 typedef c<int, I> J;
|
|
33 I i;
|
|
34 J j;
|
|
35 void qux (J x) { j = x; }
|
|
36 };
|
|
37 template <typename>
|
|
38 struct K {
|
|
39 K(D<A> x) : k (x) {}
|
|
40 typedef H::J L;
|
|
41 struct M { L m; H n, o; };
|
|
42 struct N : F<D<int>>::G<A>::O, M { N (F<D>::G<A>::O); };
|
|
43 void quux ();
|
|
44 N k;
|
|
45 };
|
|
46 template <typename T>
|
|
47 void
|
|
48 K<T>::quux ()
|
|
49 {
|
|
50 L K (k.m - 1);
|
|
51 k.n.qux (K);
|
|
52 }
|
|
53 template <typename, typename = int>
|
|
54 struct P : K<int> {
|
|
55 template <typename T>
|
|
56 P (T x, T, D<A> y = D<A> ()) : K (y) { corge (x); }
|
|
57 template <typename T> void corge (T);
|
|
58 typedef L L;
|
|
59 };
|
|
60 template <typename T, typename U>
|
|
61 template <typename V>
|
|
62 void P<T, U>::corge (V y)
|
|
63 {
|
|
64 quux ();
|
|
65 for (L x = k.n.j; x < k.o.j; ++x)
|
|
66 {
|
|
67 ++y;
|
|
68 D<int> pv;
|
|
69 baz (y, *x, pv);
|
|
70 }
|
|
71 D<int> z;
|
|
72 baz (y, k.o.i, z);
|
|
73 }
|
|
74 struct A {
|
|
75 A (int x) : a (x) {}
|
|
76 int a;
|
|
77 };
|
|
78 int a[2]{};
|
|
79
|
|
80 int
|
|
81 main ()
|
|
82 {
|
|
83 P<int> (a, a);
|
|
84 return 0;
|
|
85 }
|