]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/20_util/function_objects/binders/1.cc
1 // Copyright (C) 2005-2024 Free Software Foundation, Inc.
3 // This file is part of the GNU ISO C++ Library. This library is free
4 // software; you can redistribute it and/or modify it under the
5 // terms of the GNU General Public License as published by the
6 // Free Software Foundation; either version 3, or (at your option)
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License along
15 // with this library; see the file COPYING3. If not see
16 // <http://www.gnu.org/licenses/>.
20 // { dg-options "-Wno-deprecated-declarations" }
28 void f_void_int_const(int) const {}
29 void f_void_int(int) {}
30 int f_int_int_const(int) const { return 1; }
31 int f_int_int(int) {return 1; }
32 void f_void_void_const() const {}
34 int f_int_void_const() const { return 1; }
35 int f_int_void() { return 1; }
40 mem_fun_t
<void, s
> p1(&s::f_void_void
);
41 mem_fun_t
<int, s
> p2(&s::f_int_void
);
44 mem_fun1_t
<void, s
, int> q1(&s::f_void_int
);
45 mem_fun1_t
<int, s
, int> q2(&s::f_int_int
);
49 (mem_fun(&s::f_void_void
))(&a
);
50 (mem_fun(&s::f_void_int
))(&a
,0);
51 (mem_fun(&s::f_int_void
))(&a
);
52 (mem_fun(&s::f_int_int
))(&a
,0);
54 mem_fun_ref_t
<void, s
> ref1(&s::f_void_void
);
55 mem_fun_ref_t
<int, s
> ref2(&s::f_int_void
);
60 mem_fun1_ref_t
<void, s
, int> ref3(&s::f_void_int
);
61 mem_fun1_ref_t
<int, s
, int> ref4(&s::f_int_int
);
66 (mem_fun_ref(&s::f_void_void
))(a
);
67 (mem_fun_ref(&s::f_void_int
))(a
, 0);
68 (mem_fun_ref(&s::f_int_void
))(a
);
69 (mem_fun_ref(&s::f_int_int
))(a
, 0);
72 void test02(const s
& a
)
74 const_mem_fun_t
<void, s
> p1(&s::f_void_void_const
);
75 const_mem_fun_t
<int, s
> p2(&s::f_int_void_const
);
78 const_mem_fun1_t
<void, s
, int> q1(&s::f_void_int_const
);
79 const_mem_fun1_t
<int, s
, int> q2(&s::f_int_int_const
);
83 (mem_fun(&s::f_void_void_const
))(&a
);
84 (mem_fun(&s::f_void_int_const
))(&a
, 0);
85 (mem_fun(&s::f_int_void_const
))(&a
);
86 (mem_fun(&s::f_int_int_const
))(&a
, 0);
88 const_mem_fun_ref_t
<void, s
> ref1(&s::f_void_void_const
);
89 const_mem_fun_ref_t
<int, s
> ref2(&s::f_int_void_const
);
94 const_mem_fun1_ref_t
<void, s
, int> ref3(&s::f_void_int_const
);
95 const_mem_fun1_ref_t
<int, s
, int> ref4(&s::f_int_int_const
);
100 (mem_fun_ref(&s::f_void_void_const
))(a
);
101 (mem_fun_ref(&s::f_void_int_const
))(a
, 0);
102 (mem_fun_ref(&s::f_int_void_const
))(a
);
103 (mem_fun_ref(&s::f_int_int_const
))(a
, 0);