Re: [Boost-bugs] [Boost C++ Libraries] #7251: is_convertible works incorrectly for rvalue source types

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #7251: is_convertible works incorrectly for rvalue source types
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-08-31 01:04:14


#7251: is_convertible works incorrectly for rvalue source types
--------------------------------------+-------------------------------------
  Reporter: michel | Owner: johnmaddock
      Type: Patches | Status: new
 Milestone: To Be Determined | Component: type_traits
   Version: Boost Development Trunk | Severity: Problem
Resolution: | Keywords:
--------------------------------------+-------------------------------------

Comment (by michel):

 On gcc 4.5-4.6 in a C++11 mode, `Func&&` cannot be bound to `const Func&`.
 This is because,
 * An rvalue reference to function type is an rvalue, on these compilers.
 * Function type cannot be cv-qualified.

 So, on these compilers, `any_conversion` needs constructors taking rvalue
 references:
 {{{
 struct any_conversion
 {
 #ifndef BOOST_NO_RVALUE_REFERENCES
     template <typename T> any_conversion(T&&);
 #else
     template <typename T> any_conversion(const volatile T&);
     template <typename T> any_conversion(const T&);
     template <typename T> any_conversion(volatile T&);
     template <typename T> any_conversion(T&);
 #endif
 };
 }}}
 Or maybe the following is enough:
 {{{
 struct any_conversion
 {
 #ifndef BOOST_NO_RVALUE_REFERENCES
     template <typename T> any_conversion(T&&);
 #else
     template <typename T> any_conversion(T&);
 #endif
 };
 }}}

 I'm planning to make a patch which enables the recently introduced
 `is_convertible` code on gcc 4.5-4.6 with the above `any_conversion`
 modification. Does it make sense?

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/7251#comment:5>
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:10 UTC