OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [opt/] [delay-slot-1.C] - Blame information for rev 751

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
/* PR rtl-optimization/23585 */
2
/* Testcase by Matti Rintala  */
3
 
4
/* { dg-do run } */
5
/* { dg-options "-O2" } */
6
 
7
template 
8
class const_mem_fun_t
9
{
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;
20
};
21
 
22
template 
23
class const_mem_fun_ref_t
24
{
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;
35
};
36
 
37
template 
38
class const_mem_fun1_t
39
{
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;
50
};
51
 
52
 
53
template 
54
class const_mem_fun1_ref_t
55
{
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;
66
};
67
 
68
template 
69
inline const_mem_fun_t<_Ret, _Tp>
70
mem_fun(_Ret (_Tp::*__f)() const)
71
{ return const_mem_fun_t<_Ret, _Tp>(__f); }
72
 
73
template 
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); }
77
 
78
template 
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); }
82
 
83
template 
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); }
87
 
88
class Klasse {
89
public:
90
  void vf0c() const;
91
  void vf1c(const int&) const;
92
};
93
 
94
int main()
95
{
96
  Klasse obj;
97
  const Klasse& objc = obj;
98
 
99
  mem_fun(&Klasse::vf0c)(&objc);
100
  mem_fun(&Klasse::vf1c)(&objc, 1);
101
 
102
  mem_fun_ref(&Klasse::vf0c)(objc);
103
  mem_fun_ref(&Klasse::vf1c)(objc, 1);
104
  return 0;
105
}
106
 
107
void Klasse::vf0c() const
108
{}
109
 
110
void Klasse::vf1c(const int&) const
111
{}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.