Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / testsuite / g++.dg / opt / delay-slot-1.C
blobe180e48105e15287c1bb5275cb4a292dc30f373a
1 /* PR rtl-optimization/23585 */
2 /* Testcase by Matti Rintala <matti.rintala@iki.fi> */
4 /* { dg-do run } */
5 /* { dg-options "-O2" } */
7 template <class _Ret, class _Tp>
8 class const_mem_fun_t
10 public:
11   explicit
12   const_mem_fun_t(_Ret (_Tp::*__pf)() const)
13     : _M_f(__pf) {}
14   
15   _Ret
16   operator()(const _Tp* __p) const
17   { return (__p->*_M_f)(); }
18 private:
19   _Ret (_Tp::*_M_f)() const;
22 template <class _Ret, class _Tp>
23 class const_mem_fun_ref_t
25 public:
26   explicit
27   const_mem_fun_ref_t(_Ret (_Tp::*__pf)() const)
28     : _M_f(__pf) {}
29   
30   _Ret
31   operator()(const _Tp& __r) const
32   { return (__r.*_M_f)(); }
33 private:
34   _Ret (_Tp::*_M_f)() const;
37 template <class _Ret, class _Tp, class _Arg>
38 class const_mem_fun1_t
40 public:
41   explicit
42   const_mem_fun1_t(_Ret (_Tp::*__pf)(_Arg) const)
43     : _M_f(__pf) {}
44   
45   _Ret
46   operator()(const _Tp* __p, _Arg __x) const
47   { return (__p->*_M_f)(__x); }
48 private:
49   _Ret (_Tp::*_M_f)(_Arg) const;
53 template <class _Ret, class _Tp, class _Arg>
54 class const_mem_fun1_ref_t
56 public:
57   explicit
58   const_mem_fun1_ref_t(_Ret (_Tp::*__pf)(_Arg) const)
59     : _M_f(__pf) {}
60   
61   _Ret
62   operator()(const _Tp& __r, _Arg __x) const
63   { return (__r.*_M_f)(__x); }
64 private:
65   _Ret (_Tp::*_M_f)(_Arg) const;
68 template <class _Ret, class _Tp>
69 inline const_mem_fun_t<_Ret, _Tp>
70 mem_fun(_Ret (_Tp::*__f)() const)
71 { return const_mem_fun_t<_Ret, _Tp>(__f); }
73 template <class _Ret, class _Tp>
74 inline const_mem_fun_ref_t<_Ret, _Tp>
75 mem_fun_ref(_Ret (_Tp::*__f)() const)
76 { return const_mem_fun_ref_t<_Ret, _Tp>(__f); }
78 template <class _Ret, class _Tp, class _Arg>
79 inline const_mem_fun1_t<_Ret, _Tp, _Arg>
80 mem_fun(_Ret (_Tp::*__f)(_Arg) const)
81 { return const_mem_fun1_t<_Ret, _Tp, _Arg>(__f); }
83 template <class _Ret, class _Tp, class _Arg>
84 inline const_mem_fun1_ref_t<_Ret, _Tp, _Arg>
85 mem_fun_ref(_Ret (_Tp::*__f)(_Arg) const)
86 { return const_mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
88 class Class {
89 public:
90   void vf0c() const;
91   void vf1c(const int&) const;
94 int main()
96   Class obj;
97   const Class& objc = obj;
99   mem_fun(&Class::vf0c)(&objc);
100   mem_fun(&Class::vf1c)(&objc, 1);
102   mem_fun_ref(&Class::vf0c)(objc);
103   mem_fun_ref(&Class::vf1c)(objc, 1);
104   return 0;
107 void Class::vf0c() const
110 void Class::vf1c(const int&) const