This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

libstdc++/2772: bind2nd(mem_fun1_ref) does not work



>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:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]