public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "fang at csl dot cornell dot edu" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/39136]  New: std::mem_fun_ref fails to accept a member function whose second argument with default value
Date: Mon, 09 Feb 2009 06:50:00 -0000	[thread overview]
Message-ID: <bug-39136-3227@http.gcc.gnu.org/bugzilla/> (raw)

std::mem_fun_ref fails to accept a member function whose second argument can be
bound to a default value.  In this example, I use vector<>::resize.  

Test case:
#include <vector>
#include <functional>
#include <algorithm>

using std::vector;
using std::mem_fun_ref;
using std::bind2nd;
using std::for_each;

typedef vector<int>             int_vec;
Test case:

typedef vector<int_vec>         matrix;

void
test(void) {
        matrix M;
        M.resize(4);
        for_each(M.begin(), M.end(),
                bind2nd(mem_fun_ref(&int_vec::resize), 4));
}

Compile: g++ -O3 -W -Wall -Werror -ansi -pedantic-errors  -c vector.cc -o
vector.o

Diagnostic:
vector.cc: In function 'void test()':
vector.cc:18: error: no matching function for call to 'mem_fun_ref(void
(std::vector<int, std::allocator<int> >::*)(long unsigned int, int))'
make: *** [vector.o] Error 1

Known to "work": 4.0.1
Fail: 4.3.2 4.3.3

I'm not sure if this is valid code.  However, the standard seems to indicate
that resize(size_type), is a required member function (or at least interface)
of std::vector.  Does the standard (20.6.13) allow mem_fun_ref and such to bind
to member functions with default values in the tail position?


-- 
           Summary: std::mem_fun_ref fails to accept a member function whose
                    second argument with default value
           Product: gcc
           Version: 4.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fang at csl dot cornell dot edu


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


             reply	other threads:[~2009-02-09  6:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-09  6:50 fang at csl dot cornell dot edu [this message]
2009-02-09  7:39 ` [Bug libstdc++/39136] " fang at csl dot cornell dot edu
2009-02-09  9:53 ` paolo dot carlini at oracle dot com
2009-02-09 15:59 ` fang at csl dot cornell dot edu
2009-02-09 16:11 ` paolo dot carlini at oracle dot com
2009-02-09 16:47 ` paolo dot carlini at oracle dot com
2009-02-09 17:21 ` fang at csl dot cornell dot edu
2009-02-09 17:26 ` paolo dot carlini at oracle dot com
2009-02-09 17:54 ` fang at csl dot cornell dot edu
2009-02-09 17:59 ` paolo dot carlini at oracle dot com
2009-02-10 22:03 ` pinskia at gcc dot gnu dot org
2009-02-10 22:03 ` pinskia at gcc dot gnu dot org

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-39136-3227@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).