|
Boost : |
Subject: [boost] [test] possible bug in 1.47.0
From: Damian Vicino (damian.vicino_at_[hidden])
Date: 2015-06-02 01:58:32
Hi,
Iâm working in the safe_float library and while working on it I defined a partial specialisation of numeric_limits for safe_float.
I wanted the safe_float<T> to mimic the T numeric_limits in most of the values and just change a few, but nothing complex, one liners only.
Then, I created a test for validating those methods/attributes mimicking the internal T are equal to those on T, as follows:
//types to be tested
using test_types=boost::mpl::list<
float, double, long double
>;
using namespace boost::safe_float;
BOOST_AUTO_TEST_CASE_TEMPLATE( safe_float_numeric_limits_basic_fp_types, FPT, test_types){
BOOST_CHECK_EQUAL(std::numeric_limits<safe_float<FPT>>::is_specialized, std::numeric_limits<FPT>::is_specialized);
}
The test does not even compile:
Undefined symbols for architecture x86_64:
"std::__1::numeric_limits<boost::safe_float::safe_float<double, boost::safe_float::policy::check_addition_overflow, boost::safe_float::policy::on_fail_throw, boost::safe_float::policy::cast_none> >::is_specialized", referenced from:
safe_float_numeric_limits_suite::safe_float_numeric_limits_basic_fp_types<double>::test_method() in numeric_limits_test.o
After looking at the numeric_limits specialisation for a while, I tried changing the test as follows:
if (std::numeric_limits<safe_float<FPT>>::is_specialized == std::numeric_limits<FPT>::is_specialized){
BOOST_CHECK(true);
} else {
BOOST_CHECK(false);
}
And as follows:
BOOST_CHECK(std::numeric_limits<safe_float<FPT>>::is_specialized == std::numeric_limits<FPT>::is_specialized);
Both alternatives work.
Is there something wrong with BOOST_CHECK_EQUAL?
Iâm using version 1.47.0
Best regards,
Damian
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk