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

             Bug #: 52612
           Summary: std::tr1::bind doesn't work with placeholders
    Classification: Unclassified
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: anthony....@gmail.com


Created attachment 26913
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26913
Example code that fails

The following simple code doesn't compile:

#include <tr1/functional>

int return_int2(int,int)
{
    return 42;
}

int main(){
    std::tr1::bind(return_int2,32,std::tr1::placeholders::_1)(5);
}

Compiler output:

$g++ t2.cpp 
t2.cpp: In function ‘int main()’:
t2.cpp:9:64: error: no match for call to ‘(std::tr1::_Bind<int (*(int,
std::tr1::_Placeholder<1>))(int, int)>) (int)’
/usr/include/c++/4.6/tr1/functional:1134:11: note: candidates are:
/usr/include/c++/4.6/tr1/functional:1205:9: note: typename
std::tr1::result_of<_Functor(typename
std::tr1::result_of<std::tr1::_Mu<_Bound_args>(_Bound_args,
std::tr1::tuple<_UElements ...>)>::type ...)>::type
std::tr1::_Bind<_Functor(_Bound_args ...)>::operator()(_Args& ...) [with _Args
= {int}, _Functor = int (*)(int, int), _Bound_args = {int,
std::tr1::_Placeholder<1>}, typename std::tr1::result_of<_Functor(typename
std::tr1::result_of<std::tr1::_Mu<_Bound_args>(_Bound_args,
std::tr1::tuple<_UElements ...>)>::type ...)>::type = int]
/usr/include/c++/4.6/tr1/functional:1205:9: note:   no known conversion for
argument 1 from ‘int’ to ‘int&’
/usr/include/c++/4.6/tr1/functional:1216:9: note: typename
std::tr1::result_of<const _Functor(typename
std::tr1::result_of<std::tr1::_Mu<_Bound_args>(_Bound_args,
std::tr1::tuple<_UElements ...>)>::type ...)>::type
std::tr1::_Bind<_Functor(_Bound_args ...)>::operator()(_Args& ...) const [with
_Args = {int}, _Functor = int (*)(int, int), _Bound_args = {int,
std::tr1::_Placeholder<1>}, typename std::tr1::result_of<const
_Functor(typename std::tr1::result_of<std::tr1::_Mu<_Bound_args>(_Bound_args,
std::tr1::tuple<_UElements ...>)>::type ...)>::type = int]
/usr/include/c++/4.6/tr1/functional:1216:9: note:   no known conversion for
argument 1 from ‘int’ to ‘int&’
/usr/include/c++/4.6/tr1/functional:1228:9: note: typename
std::tr1::result_of<volatile _Functor(typename
std::tr1::result_of<std::tr1::_Mu<_Bound_args>(_Bound_args,
std::tr1::tuple<_UElements ...>)>::type ...)>::type
std::tr1::_Bind<_Functor(_Bound_args ...)>::operator()(_Args& ...) volatile
[with _Args = {int}, _Functor = int (*)(int, int), _Bound_args = {int,
std::tr1::_Placeholder<1>}, typename std::tr1::result_of<volatile
_Functor(typename std::tr1::result_of<std::tr1::_Mu<_Bound_args>(_Bound_args,
std::tr1::tuple<_UElements ...>)>::type ...)>::type = int]
/usr/include/c++/4.6/tr1/functional:1228:9: note:   no known conversion for
argument 1 from ‘int’ to ‘int&’
/usr/include/c++/4.6/tr1/functional:1241:9: note: typename
std::tr1::result_of<const volatile _Functor(typename
std::tr1::result_of<std::tr1::_Mu<_Bound_args>(_Bound_args,
std::tr1::tuple<_UElements ...>)>::type ...)>::type
std::tr1::_Bind<_Functor(_Bound_args ...)>::operator()(_Args& ...) const
volatile [with _Args = {int}, _Functor = int (*)(int, int), _Bound_args = {int,
std::tr1::_Placeholder<1>}, typename std::tr1::result_of<const volatile
_Functor(typename std::tr1::result_of<std::tr1::_Mu<_Bound_args>(_Bound_args,
std::tr1::tuple<_UElements ...>)>::type ...)>::type = int]
/usr/include/c++/4.6/tr1/functional:1241:9: note:   no known conversion for
argument 1 from ‘int’ to ‘int&’


$ g++ --version
g++ (Ubuntu 4.6.0-3~ppa1) 4.6.1 20110409 (prerelease)
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Reply via email to