Fix some warnings within tests.

This commit is contained in:
Kohei Takahashi
2015-01-21 01:13:19 +09:00
parent ce8bf1079a
commit 5e4978b870
5 changed files with 43 additions and 16 deletions

View File

@ -95,7 +95,7 @@ main()
#endif #endif
{ {
boost::array<std::size_t, 2> a = { 10, 50 }; boost::array<std::size_t, 2> a = {{ 10, 50 }};
BOOST_TEST(back(pop_back(a)) == 10); BOOST_TEST(back(pop_back(a)) == 10);
} }

View File

@ -7,6 +7,7 @@
http://www.boost.org/LICENSE_1_0.txt). http://www.boost.org/LICENSE_1_0.txt).
==============================================================================*/ ==============================================================================*/
#include <boost/config.hpp>
#include <boost/fusion/functional/invocation/invoke.hpp> #include <boost/fusion/functional/invocation/invoke.hpp>
#include <boost/detail/lightweight_test.hpp> #include <boost/detail/lightweight_test.hpp>
@ -146,11 +147,28 @@ class members
int binary_c(int i, object) const { return data + 6 + i; } int binary_c(int i, object) const { return data + 6 + i; }
}; };
#ifdef BOOST_NO_CXX11_SMART_PTR
typedef std::auto_ptr<members > members_ptr;
typedef std::auto_ptr<members const> const_members_ptr;
#else
typedef std::unique_ptr<members > members_ptr;
typedef std::unique_ptr<members const> const_members_ptr;
#endif
struct derived struct derived
: members : members
{ {
}; };
#ifdef BOOST_NO_CXX11_SMART_PTR
typedef std::auto_ptr<derived > derived_ptr;
typedef std::auto_ptr<derived const> const_derived_ptr;
#else
typedef std::unique_ptr<derived > derived_ptr;
typedef std::unique_ptr<derived const> const_derived_ptr;
#endif
typedef int element1_type; typedef int element1_type;
typedef object element2_type; typedef object element2_type;
typedef object_nc & element3_type; typedef object_nc & element3_type;
@ -161,8 +179,8 @@ object_nc element3;
members that; members that;
std::auto_ptr<members> spt_that(new members); members_ptr spt_that(new members);
std::auto_ptr<members const> spt_that_c(new members); const_members_ptr spt_that_c(new members);
fusion::single_view<members > sv_obj_ctx( that); fusion::single_view<members > sv_obj_ctx( that);
fusion::single_view<members &> sv_ref_ctx( that); fusion::single_view<members &> sv_ref_ctx( that);
@ -170,13 +188,13 @@ fusion::single_view<members *> sv_ptr_ctx(& that);
fusion::single_view<members const > sv_obj_c_ctx( that); fusion::single_view<members const > sv_obj_c_ctx( that);
fusion::single_view<members const &> sv_ref_c_ctx( that); fusion::single_view<members const &> sv_ref_c_ctx( that);
fusion::single_view<members const *> sv_ptr_c_ctx(& that); fusion::single_view<members const *> sv_ptr_c_ctx(& that);
fusion::single_view<std::auto_ptr<members> const &> sv_spt_ctx(spt_that); fusion::single_view<members_ptr const &> sv_spt_ctx(spt_that);
fusion::single_view< std::auto_ptr<members const> const &> sv_spt_c_ctx(spt_that_c); fusion::single_view<const_members_ptr const &> sv_spt_c_ctx(spt_that_c);
derived derived_that; derived derived_that;
std::auto_ptr<derived> spt_derived_that(new derived); derived_ptr spt_derived_that(new derived);
std::auto_ptr<derived const> spt_derived_that_c(new derived); const_derived_ptr spt_derived_that_c(new derived);
fusion::single_view<derived > sv_obj_d_ctx( derived_that); fusion::single_view<derived > sv_obj_d_ctx( derived_that);
fusion::single_view<derived &> sv_ref_d_ctx( derived_that); fusion::single_view<derived &> sv_ref_d_ctx( derived_that);
@ -184,8 +202,8 @@ fusion::single_view<derived *> sv_ptr_d_ctx(& derived_that);
fusion::single_view<derived const > sv_obj_c_d_ctx( derived_that); fusion::single_view<derived const > sv_obj_c_d_ctx( derived_that);
fusion::single_view<derived const &> sv_ref_c_d_ctx( derived_that); fusion::single_view<derived const &> sv_ref_c_d_ctx( derived_that);
fusion::single_view<derived const *> sv_ptr_c_d_ctx(& derived_that); fusion::single_view<derived const *> sv_ptr_c_d_ctx(& derived_that);
fusion::single_view<std::auto_ptr<derived> const &> sv_spt_d_ctx(spt_derived_that); fusion::single_view<derived_ptr const &> sv_spt_d_ctx(spt_derived_that);
fusion::single_view< std::auto_ptr<derived const> const &> sv_spt_c_d_ctx(spt_derived_that_c); fusion::single_view<const_derived_ptr const &> sv_spt_c_d_ctx(spt_derived_that_c);
template <class Sequence> template <class Sequence>
void test_sequence_n(Sequence & seq, mpl::int_<0>) void test_sequence_n(Sequence & seq, mpl::int_<0>)

View File

@ -7,6 +7,7 @@
http://www.boost.org/LICENSE_1_0.txt). http://www.boost.org/LICENSE_1_0.txt).
==============================================================================*/ ==============================================================================*/
#include <boost/config.hpp>
#include <boost/fusion/functional/invocation/invoke_procedure.hpp> #include <boost/fusion/functional/invocation/invoke_procedure.hpp>
#include <boost/detail/lightweight_test.hpp> #include <boost/detail/lightweight_test.hpp>
@ -65,9 +66,17 @@ class members
int binary_c(int & i, object) const { return i = data + 6; } int binary_c(int & i, object) const { return i = data + 6; }
}; };
#ifdef BOOST_NO_CXX11_SMART_PTR
typedef std::auto_ptr<members > members_ptr;
typedef std::auto_ptr<members const> const_members_ptr;
#else
typedef std::unique_ptr<members > members_ptr;
typedef std::unique_ptr<members const> const_members_ptr;
#endif
members that; members that;
std::auto_ptr<members> spt_that(new members); members_ptr spt_that(new members);
std::auto_ptr<members const> spt_that_c(new members); const_members_ptr spt_that_c(new members);
fusion::single_view<members > sv_obj_ctx( that); fusion::single_view<members > sv_obj_ctx( that);
fusion::single_view<members &> sv_ref_ctx( that); fusion::single_view<members &> sv_ref_ctx( that);
@ -75,8 +84,8 @@ fusion::single_view<members *> sv_ptr_ctx(& that);
fusion::single_view<members const > sv_obj_c_ctx( that); fusion::single_view<members const > sv_obj_c_ctx( that);
fusion::single_view<members const &> sv_ref_c_ctx( that); fusion::single_view<members const &> sv_ref_c_ctx( that);
fusion::single_view<members const *> sv_ptr_c_ctx(& that); fusion::single_view<members const *> sv_ptr_c_ctx(& that);
fusion::single_view<std::auto_ptr<members> const &> sv_spt_ctx(spt_that); fusion::single_view<members_ptr const &> sv_spt_ctx(spt_that);
fusion::single_view< std::auto_ptr<members const> const &> sv_spt_c_ctx(spt_that_c); fusion::single_view<const_members_ptr const &> sv_spt_c_ctx(spt_that_c);
struct fobj struct fobj
{ {

View File

@ -178,7 +178,7 @@ main()
{ {
fusion::vector<int, float> v1(4, 2); fusion::vector<int, float> v1(4, 2);
ns::bar v2 = {5, 3}; ns::bar v2 = {{5}, 3};
BOOST_TEST(v1 < v2); BOOST_TEST(v1 < v2);
BOOST_TEST(v1 <= v2); BOOST_TEST(v1 <= v2);
BOOST_TEST(v2 > v1); BOOST_TEST(v2 > v1);

View File

@ -38,12 +38,12 @@ namespace test_detail
return *this; return *this;
} }
x(x const& rhs) x(x const& /*rhs*/)
{ {
incr_copy(); incr_copy();
} }
x& operator=(x const& rhs) x& operator=(x const& /*rhs*/)
{ {
incr_copy(); incr_copy();
return *this; return *this;