Subject: [Boost-bugs] [Boost C++ Libraries] #9215: Infinite loop when `any` constructor called for `const any&&`
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-10-09 11:37:28
#9215: Infinite loop when `any` constructor called for `const any&&`
------------------------------+------------------------
Reporter: apolukhin | Owner: nasonov
Type: Bugs | Status: new
Milestone: Boost 1.55.0 | Component: any
Version: Boost 1.54.0 | Severity: Regression
Keywords: any const rvalue |
------------------------------+------------------------
Code at line 70 in boost/any.hpp must look like this:
{{{
template<typename ValueType>
any(ValueType&& value
, typename boost::disable_if<boost::is_same<any&, ValueType>
>::type* = 0 // disable if value has type `any&`
, typename boost::disable_if<boost::is_const<ValueType>
>::type* = 0) // disable if value has type `const ValueType&&`
: content(new holder< typename remove_reference<ValueType>::type
>(static_cast<ValueType&&>(value)))
{
}
}}}
Test case:
{{{
#include <boost/any.hpp>
#include <string>
const boost::any getBoolVal()
{
return false;
}
int main()
{
boost::any vals[] = {1.0, std::string("1m"), getBoolVal()};
}
}}}
Thanks to Bo Peng for finding this issue!
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/9215> 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:14 UTC