1 /* PR rtl-optimization/23585 */
2 /* Testcase by Matti Rintala <matti.rintala@iki.fi> */
5 /* { dg-options "-O2" } */
7 template <class _Ret, class _Tp>
12 const_mem_fun_t(_Ret (_Tp::*__pf)() const)
16 operator()(const _Tp* __p) const
17 { return (__p->*_M_f)(); }
19 _Ret (_Tp::*_M_f)() const;
22 template <class _Ret, class _Tp>
23 class const_mem_fun_ref_t
27 const_mem_fun_ref_t(_Ret (_Tp::*__pf)() const)
31 operator()(const _Tp& __r) const
32 { return (__r.*_M_f)(); }
34 _Ret (_Tp::*_M_f)() const;
37 template <class _Ret, class _Tp, class _Arg>
38 class const_mem_fun1_t
42 const_mem_fun1_t(_Ret (_Tp::*__pf)(_Arg) const)
46 operator()(const _Tp* __p, _Arg __x) const
47 { return (__p->*_M_f)(__x); }
49 _Ret (_Tp::*_M_f)(_Arg) const;
53 template <class _Ret, class _Tp, class _Arg>
54 class const_mem_fun1_ref_t
58 const_mem_fun1_ref_t(_Ret (_Tp::*__pf)(_Arg) const)
62 operator()(const _Tp& __r, _Arg __x) const
63 { return (__r.*_M_f)(__x); }
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); }
91 void vf1c(const int&) const;
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);
107 void Class::vf0c() const
110 void Class::vf1c(const int&) const