public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/39136]  New: std::mem_fun_ref fails to accept a member function whose second argument with default value
@ 2009-02-09  6:50 fang at csl dot cornell dot edu
  2009-02-09  7:39 ` [Bug libstdc++/39136] " fang at csl dot cornell dot edu
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: fang at csl dot cornell dot edu @ 2009-02-09  6:50 UTC (permalink / raw)
  To: gcc-bugs

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


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

end of thread, other threads:[~2009-02-10 22:03 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-09  6:50 [Bug libstdc++/39136] New: std::mem_fun_ref fails to accept a member function whose second argument with default value fang at csl dot cornell dot edu
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

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).