[Bug c++/37811] New: bind1st fails on mem_fun with reference argument
igodard at pacbell dot net
gcc-bugzilla@gcc.gnu.org
Sun Oct 12 18:54:00 GMT 2008
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
More information about the Gcc-bugs
mailing list