From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6688 invoked by alias); 12 Oct 2008 18:54:43 -0000 Received: (qmail 6569 invoked by uid 48); 12 Oct 2008 18:53:24 -0000 Date: Sun, 12 Oct 2008 18:54:00 -0000 Subject: [Bug c++/37811] New: bind1st fails on mem_fun with reference argument X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "igodard at pacbell dot net" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2008-10/txt/msg00798.txt.bz2 This code: #include 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 >’: 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]’ 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]’ /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 >’: 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]’ 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]’ 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