Subject: [Boost-bugs] [Boost C++ Libraries] #6742: C4789 warning using boost range on visual 2010
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-03-29 16:16:51
#6742: C4789 warning using boost range on visual 2010
----------------------------------------+-----------------------------------
Reporter: benjamint@⦠| Owner: neilgroves
Type: Bugs | Status: new
Milestone: To Be Determined | Component: range
Version: Boost 1.47.0 | Severity: Problem
Keywords: range visual C4789 |
----------------------------------------+-----------------------------------
Hello,
I am compiling under Windows XP using Visual Studio 2010.
When I use boost::range, I have some strange compilation warning "warning
C4789: destination of memory copy is too small".
Here is a small unit test that reproduces this warning:
{{{
#define BOOST_TEST_MODULE boost_range_c4789_test
#include <boost/phoenix/core.hpp>
#include <boost/phoenix/operator.hpp>
#include <boost/range.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/algorithm_ext.hpp>
#include <boost/test/unit_test.hpp>
#include <vector>
/**
\deftestgroup{boost_range_c4789_test}
\brief Test a spurious C4789 MSVC warning that happens with boost range
@{
**/
struct FooType
{
double a,b;
};
//-----------------------------------------------------------------------------
/**
\testdesc The actual test
**/
BOOST_AUTO_TEST_CASE( boost_range_c4789_bug )
{
using namespace boost::phoenix::arg_names;
using namespace boost::adaptors;
FooType foo;
foo.a = 2.;
foo.b = -4.;
size_t numelem = 10;
std::vector<FooType> foovec(numelem,foo);
std::vector<double> barvec;
boost::push_back( barvec, foovec | transformed( (&arg1)->*& FooType::a
) );
BOOST_CHECK( barvec == std::vector<double>(numelem,foo.a) );
}
///@}
}}}
Thanks for your help,
Benjamin.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/6742> 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:09 UTC