When using BOOST_TEST_CLOSE_FRACTION with
cpp_dec_float and et_off, I get a lot of ambiguous name
errors for enable_if and disable_if in multiprecision.
It seems as though the same symbols enable_if and
disable_if reside in both the namespace boost as well
as deeper in the boost::test namespaces.
Is this a known problem? Am I doing something wrong?
No. Do you have a reduced test case?
Thanks, John.
Yes. The test case below tests cyl_bessel_j for
cpp_dec_float_50 with et_off.
In my trunk with VC11 (Visual Studio 2012) with the
test case below, I find numerous errors here due to
ambiguous names in
.
Note that the test uses the *header-only* version
of unit_test from Boost.Test. The ambiguity does
not arise with the non-header-only version.
The names "enable_if" and "disable_if" are ambiguous
because they are present in the namespace "boost"
as well as in "boost::unit_test::decorator". In addition,
there is symbol-injection via a using directive in
Boost.Test which, although needed by Boost.Test,
seems to cause the ambiguity.
Modifying by
replacing enable_if with boost::enable_if, etc. resolves
the ambiguity.
I don't know the best way to go here. There could be a
variety of code-based solutions. We could also make a
simple work-around stating to avoid using the header-only
test in combination with multiprecision until the issue
can be properly resolved.
Thank you.
Sincerely, Chris.
------------------------------------------------------------------------------
#define BOOST_TEST_MODULE my_test
#include
#include
#define BOOST_TEST_MAIN
#include // Note: header-only Boost.Test
#include
BOOST_AUTO_TEST_CASE(my_test)
{
typedef boost::multiprecision::number,
boost::multiprecision::et_off> mp_type;
static const mp_type tolerance = std::numeric_limits::epsilon() * 1.0e12;
static const mp_type test_value (boost::math::cyl_bessel_j(mp_type(1) / 3, mp_type(12) / 7));
static const mp_type control_value("0.563386078529485398523077867872975885570767812499129930878677");
BOOST_CHECK_CLOSE_FRACTION(test_value, control_value, tolerance);
}
//'enable_if' : ambiguous symbol
// could be 'C:\boost_trunk\boost/utility/enable_if.hpp(36) : boost::enable_if'
// or 'C:\boost_trunk\boost/test/tree/decorator.hpp(184) : boost::unit_test::decorator::enable_if'