Changes the test cases, as the behaviour about const-qualifier for

attribute_type and attribute_const_type when type is deduced can be
different than when the type is provided.

Indeed when specifying attribute_type and attribute_const_type manually
it's possible to provide a type which isn't const qualified as
attribute_const_type. When deducing the types from the get_expr, a const
and a non const qualified type is taken respectively for attribute_type
and attribute_const_type.
This commit is contained in:
Damien Buhl (alias daminetreg)
2014-10-22 22:06:31 +02:00
parent 020b22f9b9
commit e50f5852e4
2 changed files with 31 additions and 8 deletions

View File

@ -84,7 +84,7 @@
BOOST_PP_IF(DEDUCE_TYPE, \ BOOST_PP_IF(DEDUCE_TYPE, \
BOOST_FUSION_ADT_ATTRIBUTE_TYPEOF, \ BOOST_FUSION_ADT_ATTRIBUTE_TYPEOF, \
BOOST_FUSION_ADT_ATTRIBUTE_GIVENTYPE \ BOOST_FUSION_ADT_ATTRIBUTE_GIVENTYPE \
)(NAME_SEQ, ATTRIBUTE, ATTRIBUTE_TUPEL_SIZE) /* XXX: Check PROXY PREFIX */\ )(NAME_SEQ, ATTRIBUTE, ATTRIBUTE_TUPEL_SIZE) \
\ \
template<class Val> \ template<class Val> \
BOOST_FUSION_GPU_ENABLED \ BOOST_FUSION_GPU_ENABLED \
@ -98,7 +98,7 @@
} \ } \
\ \
BOOST_FUSION_GPU_ENABLED \ BOOST_FUSION_GPU_ENABLED \
static type /* TODO: Check Type here */ \ static type \
boost_fusion_adapt_adt_impl_get( \ boost_fusion_adapt_adt_impl_get( \
BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ)& obj) \ BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ)& obj) \
{ \ { \
@ -107,7 +107,7 @@
} \ } \
\ \
BOOST_FUSION_GPU_ENABLED \ BOOST_FUSION_GPU_ENABLED \
static const_type /* TODO: check Const Type here */ \ static const_type \
boost_fusion_adapt_adt_impl_get( \ boost_fusion_adapt_adt_impl_get( \
BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) const& obj) \ BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) const& obj) \
{ \ { \
@ -128,7 +128,7 @@
typedef typename access::adt_attribute_access< \ typedef typename access::adt_attribute_access< \
BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) \ BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) \
, I \ , I \
>::const_type type; /* TODO: check const Type here */ \ >::const_type type; \
\ \
BOOST_FUSION_GPU_ENABLED \ BOOST_FUSION_GPU_ENABLED \
explicit \ explicit \
@ -167,7 +167,7 @@
typedef typename access::adt_attribute_access< \ typedef typename access::adt_attribute_access< \
BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) \ BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) \
, I \ , I \
>::type type; /* TODO: check Type here */ \ >::type type; \
\ \
BOOST_FUSION_GPU_ENABLED \ BOOST_FUSION_GPU_ENABLED \
explicit \ explicit \

View File

@ -102,9 +102,9 @@ namespace ns
#if BOOST_PP_VARIADICS #if BOOST_PP_VARIADICS
BOOST_FUSION_ADAPT_ADT( BOOST_FUSION_ADAPT_ADT(
ns::point, ns::point,
(BOOST_FUSION_ADAPT_AUTO, BOOST_FUSION_ADAPT_AUTO, obj.get_x(), obj.set_x(val)) (int, int, obj.get_x(), obj.set_x(val))
(obj.get_y(), obj.set_y(val)) (BOOST_FUSION_ADAPT_AUTO, BOOST_FUSION_ADAPT_AUTO, obj.get_y(), obj.set_y(val))
(int, int, obj.get_z(), obj.set_z(val)) (obj.get_z(), obj.set_z(val))
) )
# if !BOOST_WORKAROUND(__GNUC__,<4) # if !BOOST_WORKAROUND(__GNUC__,<4)
@ -255,6 +255,7 @@ main()
#endif #endif
{ {
// Check types provided in case it's provided
BOOST_MPL_ASSERT(( BOOST_MPL_ASSERT((
boost::is_same< boost::is_same<
boost::fusion::result_of::front<ns::point>::type, boost::fusion::result_of::front<ns::point>::type,
@ -275,6 +276,28 @@ main()
boost::fusion::result_of::front<ns::point const>::type::type, boost::fusion::result_of::front<ns::point const>::type::type,
int int
>)); >));
// Check types provided in case it's deduced
BOOST_MPL_ASSERT((
boost::is_same<
boost::fusion::result_of::back<ns::point>::type,
boost::fusion::extension::adt_attribute_proxy<ns::point,2,false>
>));
BOOST_MPL_ASSERT((
boost::is_same<
boost::fusion::result_of::back<ns::point>::type::type,
int
>));
BOOST_MPL_ASSERT((
boost::is_same<
boost::fusion::result_of::back<ns::point const>::type,
boost::fusion::extension::adt_attribute_proxy<ns::point,2,true>
>));
BOOST_MPL_ASSERT((
boost::is_same<
boost::fusion::result_of::back<ns::point const>::type::type,
const int
>));
} }
return boost::report_errors(); return boost::report_errors();