Subject: [Boost-bugs] [Boost C++ Libraries] #6507: fusion::at missing compile time check and overflows stack
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-02-01 16:20:54
#6507: fusion::at missing compile time check and overflows stack
------------------------------+---------------------------------------------
Reporter: apolukhin | Owner: djowel
Type: Bugs | Status: new
Milestone: To Be Determined | Component: fusion
Version: Boost 1.48.0 | Severity: Problem
Keywords: |
------------------------------+---------------------------------------------
Here are the test cases:
{{{
BOOST_AUTO_TEST_CASE(testing_at_c)
{
boost::fusion::tuple<int, double> t;
boost::fusion::at_c<2>(t); // runtime stack overflow
}
BOOST_AUTO_TEST_CASE(testing_at)
{
boost::fusion::tuple<int, double> t;
boost::fusion::at<boost::mpl::int_<2> >(t); // runtime stack overflow
}
}}}
Can be fixed, by adding:
{{{
typedef typename result_of::size<Sequence>::type size_type;
BOOST_STATIC_ASSERT((size_type::value > N::value));
BOOST_STATIC_ASSERT((size_type::value >= 0));
}}}
to both fusion::at functions in {{{#include
<boost/fusion/sequence/intrinsic/at.hpp>}}}
and including
{{{
#include <boost/fusion/sequence/intrinsic/size.hpp>
#include <boost/static_assert.hpp>
}}}
headers.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/6507> 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:08 UTC