public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/37811]  New: bind1st fails on mem_fun with reference argument
@ 2008-10-12 18:54 igodard at pacbell dot net
  2008-10-13  8:45 ` [Bug libstdc++/37811] " paolo dot carlini at oracle dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: igodard at pacbell dot net @ 2008-10-12 18:54 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2845 bytes --]

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2008-10-13 19:09 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-12 18:54 [Bug c++/37811] New: bind1st fails on mem_fun with reference argument igodard at pacbell dot net
2008-10-13  8:45 ` [Bug libstdc++/37811] " paolo dot carlini at oracle dot com
2008-10-13 15:20 ` igodard at pacbell dot net
2008-10-13 15:28 ` paolo dot carlini at oracle dot com
2008-10-13 16:07 ` igodard at pacbell dot net
2008-10-13 16:24 ` paolo dot carlini at oracle dot com
2008-10-13 17:03 ` igodard at pacbell dot net
2008-10-13 17:14 ` paolo dot carlini at oracle dot com
2008-10-13 17:56 ` igodard at pacbell dot net
2008-10-13 19:09 ` paolo dot carlini at oracle dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).