public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "igodard at pacbell dot net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/37811]  New: bind1st fails on mem_fun with reference argument
Date: Sun, 12 Oct 2008 18:54:00 -0000	[thread overview]
Message-ID: <bug-37811-6594@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2008-10-12 18:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-12 18:54 igodard at pacbell dot net [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-37811-6594@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).