* gcc.target/i386/mpx/hard-reg-1-nov.c (mpx_test): Use "esp"
[official-gcc.git] / gcc / testsuite / g++.dg / pr64688.C
blob3525e49b735bdf08a27b750932975daa952a0260
1 // { dg-do compile { target i?86-*-* x86_64-*-* } }
2 // { dg-options "-std=c++11 -O3 -march=westmere" }
4 template <typename T> struct A { typedef typename T::next type; };
5 template <typename> struct B;
6 template <typename T> struct N : T {};
7 template <int N> struct C {
8   static const int value = N;
9   typedef C<N + 1> next;
11 template <typename Sequence>
12 struct R : N<typename B<typename Sequence::tag>::template P<Sequence>> {};
13 template <typename Base> struct O : Base {
14   typedef typename A<typename Base::size>::type size;
16 template <typename = int> struct D {
17   typedef int tag;
18   typedef C<0> size;
20 template <> struct B<int> {
21   template <typename> struct P : O<O<O<D<>>>>::size {};
23 template <typename> struct F;
24 template <typename> struct G;
25 template <typename, typename, int> struct H;
26 template <typename Element, typename Layout> struct H<Element, Layout, 3> {};
27 template <int, typename E, typename L, int N> unsigned char at_c(H<E, L, N>) {}
28 template <typename> class I;
29 template <typename> class J;
30 template <typename> class K;
31 template <typename, typename> struct Q;
32 struct L {
33   typedef Q<unsigned char, F<O<O<O<D<>>>>>> *type;
35 template <typename XIterator> struct M { typedef K<J<I<XIterator>>> view_t; };
36 template <typename, typename>
37 struct Q : H<unsigned, F<int>, R<O<O<O<D<>>>>>::value> {};
38 template <typename Iterator> struct G<I<Iterator>> { typedef Iterator type; };
39 template <typename> class J {
40 public:
41   typedef G<I<Q<unsigned, int> *>>::type x_iterator;
43 template <typename> class K {
44 public:
45   J<int>::x_iterator row_begin(int);
47 template <typename Op> void measure_time(Op p1) { p1(); }
48 template <typename, typename> struct fill_nongil_t;
49 template <typename T, typename P>
50 struct fill_nongil_t<K<J<I<Q<T, F<O<O<O<D<>>>>>> *>>>, P> {
51   typedef K<J<I<Q<T, F<O<O<O<D<>>>>>> *>>> View;
52   View _v;
53   P _p;
54   fill_nongil_t(View, P);
55   void operator()() {
56     T *first = (T *)_v.row_begin(0);
57     T last;
58     while (first != &last) {
59       first[0] = first[1] = at_c<1>(_p);
60       first[2] = at_c<2>(_p);
61       first += 3;
62     }
63   }
65 template <typename, typename> void test_fill(int) {
66   M<L::type>::view_t __trans_tmp_1;
67   measure_time(fill_nongil_t<K<J<I<Q<unsigned char, F<O<O<O<D<>>>>>> *>>>,
68                              Q<unsigned char, F<O<O<O<D<>>>>>>>(
69       __trans_tmp_1, Q<unsigned char, F<O<O<O<D<>>>>>>()));
71 void performance_testtest_method() { test_fill<K<int>, Q<unsigned, int>>(0); }