This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
libstdc++/2772: bind2nd(mem_fun1_ref) does not work
- To: gcc-gnats at gcc dot gnu dot org
- Subject: libstdc++/2772: bind2nd(mem_fun1_ref) does not work
- From: eekaikko at mail dot student dot oulu dot fi
- Date: 8 May 2001 13:40:44 -0000
- Reply-To: eekaikko at mail dot student dot oulu dot fi
>Number: 2772
>Category: libstdc++
>Synopsis: bind2nd(mem_fun1_ref) does not work
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Tue May 08 06:46:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: gcc weekly snapshot
>Release: gcc version 3.0 20010430 (prerelease)
>Organization:
>Environment:
Debian gnu/linux potato
>Description:
The following code (the whole code is in the attatchment):
list<myclass> mylist;
for_each(mylist.begin(), mylist.end(),
bind2nd(mem_fun1_ref(&myclass::f), 2));
where f = "int f(int i)"
produces this message:
/usr/local/include/g++-v3/bits/stl_function.h: In member function `typename
_Operation::result_type std::binder2nd<_Operation>::operator()(typename
_Operation::first_argument_type&) const [with _Operation =
std::mem_fun1_ref_t<int, myclass, int>]':
/usr/local/include/g++-v3/bits/stl_algo.h:90: instantiated from `_Function std::for_each(_InputIter, _InputIter, _Function) [with _InputIter = std::_List_iterator<myclass, myclass&, myclass*>, _Function = std::binder2nd<std::mem_fun1_ref_t<int, myclass, int> >]'
testaus.cpp:23: instantiated from here
/usr/local/include/g++-v3/bits/stl_function.h:224: no match for call to `(const
std::mem_fun1_ref_t<int, myclass, int>) (const myclass&, const int&)'
/usr/local/include/g++-v3/bits/stl_function.h:578: candidates are: _Ret
std::mem_fun1_ref_t<_Ret, _Tp, _Arg>::operator()(_Tp&, _Arg) const [with
_Ret = int, _Tp = myclass, _Arg = int]
(See also bug #470, it seems to relate to this.)
I have tried also an older gcc-snapshot and 2.95.2 (with its own library). They produce the same error.
>How-To-Repeat:
By trying to compile (g++ testaus.cpp).
>Fix:
?
>Release-Note:
>Audit-Trail:
>Unformatted: