[Boost-bugs] [Boost C++ Libraries] #4359: boost bind doesn't work with inherited structures

Subject: [Boost-bugs] [Boost C++ Libraries] #4359: boost bind doesn't work with inherited structures
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-06-18 13:43:28


#4359: boost bind doesn't work with inherited structures
------------------------------+---------------------------------------------
 Reporter: jia3ep@… | Owner: pdimov
     Type: Bugs | Status: new
Milestone: Boost 1.44.0 | Component: bind
  Version: Boost 1.44.0 | Severity: Problem
 Keywords: |
------------------------------+---------------------------------------------
 The following code gives an error in VC++2008, VC++2010, g++ 4.2.4:

 {{{
 #include <boost/bind.hpp>

 struct Y {
         void reset() {};
 };

 template<typename T1, typename T2>
 struct my_pair {
         T1 first;
         T2 second;
 };

 template<typename T1, typename T2>
 struct my_pair2 : my_pair<T1, T2> {};

 typedef my_pair<int, Y> mypair_t;
 typedef my_pair2<int, Y> mypair2_t;

 int main()
 {
         mypair_t t1;
         mypair2_t t2;

         boost::bind<Y&>( &mypair_t::second, _1 )( t1 ).reset(); // OK!
         boost::bind<Y&>( &mypair2_t::second, _1 )( t2 ).reset(); // error:
 cannot convert from 'const Y' to 'Y &'

         return 0;
 }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4359>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:03 UTC