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]
Other format: [Raw text]

[Bug c++/37811] New: bind1st fails on mem_fun with reference argument


This code:
#include    <functional>
class   Foo {
public:
    void    F(int i) {}
    void    G(int& i) {}
    void    H(int* i) {}
    };

void    bar () {
            Foo f;
            Foo* fs;
            std::mem_fun(&Foo::F);
            std::mem_fun(&Foo::G);
            std::mem_fun(&Foo::H);
            std::bind1st(std::mem_fun(&Foo::F), fs);
            std::bind1st(std::mem_fun(&Foo::G), fs);
            std::bind1st(std::mem_fun(&Foo::H), fs);
            std::bind1st(std::mem_fun_ref(&Foo::F), f);
            std::bind1st(std::mem_fun_ref(&Foo::G), f);
            std::bind1st(std::mem_fun_ref(&Foo::H), f);
            }

compiles on Comeau. On gcc it gets you:

/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.3.1/../../../../include/c++/4.3.1/backward/binders.h:
In instantiation of ?std::binder1st<std::mem_fun1_t<void, Foo, int&> >?:
foo.cc:16:   instantiated from here
/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.3.1/../../../../include/c++/4.3.1/backward/binders.h:120:
error: ?typename _Operation::result_type
std::binder1st<_Operation>::operator()(typename
_Operation::second_argument_type&) const [with _Operation =
std::mem_fun1_t<void, Foo, int&>]? cannot be overloaded
/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.3.1/../../../../include/c++/4.3.1/backward/binders.h:114:
error: with ?typename _Operation::result_type
std::binder1st<_Operation>::operator()(const typename
_Operation::second_argument_type&) const [with _Operation =
std::mem_fun1_t<void, Foo, int&>]?
/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.3.1/../../../../include/c++/4.3.1/backward/binders.h:
In instantiation of ?std::binder1st<std::mem_fun1_ref_t<void, Foo, int&> >?:
foo.cc:19:   instantiated from here
/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.3.1/../../../../include/c++/4.3.1/backward/binders.h:120:
error: ?typename _Operation::result_type
std::binder1st<_Operation>::operator()(typename
_Operation::second_argument_type&) const [with _Operation =
std::mem_fun1_ref_t<void, Foo, int&>]? cannot be overloaded
/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.3.1/../../../../include/c++/4.3.1/backward/binders.h:114:
error: with ?typename _Operation::result_type
std::binder1st<_Operation>::operator()(const typename
_Operation::second_argument_type&) const [with _Operation =
std::mem_fun1_ref_t<void, Foo, int&>]?

Note that only the member functions with a reference parameter fail; pass by
value and pass by pointer are accepted.


-- 
           Summary: bind1st fails on mem_fun with reference argument
           Product: gcc
           Version: 4.3.1
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: igodard at pacbell dot net


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37811


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