public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/38238]  New: std::tr1::bind fails to compile with pointer to member function
@ 2008-11-23 15:56 fuscated at gmail dot com
  2008-11-24 14:56 ` [Bug libstdc++/38238] " paolo dot carlini at oracle dot com
  0 siblings, 1 reply; 2+ messages in thread
From: fuscated at gmail dot com @ 2008-11-23 15:56 UTC (permalink / raw)
  To: gcc-bugs

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

The following example fails to compile:

#include <tr1/functional>
#include <stdio.h>

using namespace std::tr1::placeholders;

class player
{
public:

        void play(int time) { printf("player::play(%d);\n", time);}
        void stop() { printf("player::stop();\n"); }
};


int main()
{
        player thePlayer;

        std::tr1::bind(&player::play, &thePlayer, _1)(2);

        return 0;
}


Here is the output of the compiler:

test_bind.cpp: In function ‘int main()’:
test_bind.cpp:19: error: no match for call to
‘(std::tr1::_Bind<std::tr1::_Mem_fn<void (player::*)(int)> ()(player*,
std::tr1::_Placeholder<1>)>) (int)’
/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.2/include/g++-v4/tr1_impl/functional:1190:
note: candidates are: typename std::tr1::result_of<_Functor ()(typename
std::tr1::result_of<std::tr1::_Mu<_Bound_args,
std::tr1::is_bind_expression::value, (std::tr1::is_placeholder::value > 0)>
()(_Bound_args, std::tr1::tuple<_UElements ...>)>::type ...)>::type
std::tr1::_Bind<_Functor ()(_Bound_args ...)>::operator()(_Args& ...) [with
_Args = int, _Functor = std::tr1::_Mem_fn<void (player::*)(int)>, _Bound_args =
player*, std::tr1::_Placeholder<1>]
/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.2/include/g++-v4/tr1_impl/functional:1201:
note:                 typename std::tr1::result_of<const _Functor ()(typename
std::tr1::result_of<std::tr1::_Mu<_Bound_args,
std::tr1::is_bind_expression::value, (std::tr1::is_placeholder::value > 0)>
()(_Bound_args, std::tr1::tuple<_UElements ...>)>::type ...)>::type
std::tr1::_Bind<_Functor ()(_Bound_args ...)>::operator()(_Args& ...) const
[with _Args = int, _Functor = std::tr1::_Mem_fn<void (player::*)(int)>,
_Bound_args = player*, std::tr1::_Placeholder<1>]
/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.2/include/g++-v4/tr1_impl/functional:1213:
note:                 typename std::tr1::result_of<volatile _Functor
()(typename std::tr1::result_of<std::tr1::_Mu<_Bound_args,
std::tr1::is_bind_expression::value, (std::tr1::is_placeholder::value > 0)>
()(_Bound_args, std::tr1::tuple<_UElements ...>)>::type ...)>::type
std::tr1::_Bind<_Functor ()(_Bound_args ...)>::operator()(_Args& ...) volatile
[with _Args = int, _Functor = std::tr1::_Mem_fn<void (player::*)(int)>,
_Bound_args = player*, std::tr1::_Placeholder<1>]
/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.2/include/g++-v4/tr1_impl/functional:1226:
note:                 typename std::tr1::result_of<const volatile _Functor
()(typename std::tr1::result_of<std::tr1::_Mu<_Bound_args,
std::tr1::is_bind_expression::value, (std::tr1::is_placeholder::value > 0)>
()(_Bound_args, std::tr1::tuple<_UElements ...>)>::type ...)>::type
std::tr1::_Bind<_Functor ()(_Bound_args ...)>::operator()(_Args& ...) const
volatile [with _Args = int, _Functor = std::tr1::_Mem_fn<void
(player::*)(int)>, _Bound_args = player*, std::tr1::_Placeholder<1>]


The example compiles fine by replacing tr1::bind with boost::bind.

Best regards,
Teodor Petrov


-- 
           Summary: std::tr1::bind fails to compile with pointer to member
                    function
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fuscated at gmail dot com


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


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

* [Bug libstdc++/38238] std::tr1::bind fails to compile with pointer to member function
  2008-11-23 15:56 [Bug libstdc++/38238] New: std::tr1::bind fails to compile with pointer to member function fuscated at gmail dot com
@ 2008-11-24 14:56 ` paolo dot carlini at oracle dot com
  0 siblings, 0 replies; 2+ messages in thread
From: paolo dot carlini at oracle dot com @ 2008-11-24 14:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from paolo dot carlini at oracle dot com  2008-11-24 14:55 -------
The problem is the rvalue (2)

*** This bug has been marked as a duplicate of 35569 ***


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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


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

end of thread, other threads:[~2008-11-24 14:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-23 15:56 [Bug libstdc++/38238] New: std::tr1::bind fails to compile with pointer to member function fuscated at gmail dot com
2008-11-24 14:56 ` [Bug libstdc++/38238] " 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).