|
Boost Users : |
Subject: [Boost-users] [Spirit][Math] karma: regression in 1.54 due to argument promotion in math?
From: Igor R (boost.lists_at_[hidden])
Date: 2013-07-30 05:13:56
Hello,
The following code compiles with 1.53, but fails with 1.54 (FreeBSD
9.1, gcc4.2.1):
#include <boost/spirit/include/karma.hpp>
#include <string>
#include <iterator>
int main()
{
using namespace boost::spirit::karma;
std::string result;
std::back_insert_iterator sink(result);
unsigned short a;
generate(sink, auto_, a);
}
The error is:
boost/boost/math/tools/promotion.hpp: In instantiation of
'boost::math::tools::promote_args<long double, float, float, float,
float, float>':
boost/boost/math/special_functions/sign.hpp:114: instantiated from
'int boost::math::signbit(T) [with T = long double]'
boost/boost/spirit/home/support/detail/sign.hpp:47: instantiated
from 'bool boost::spirit::detail::signbit(T) [with T = long double]'
boost/boost/spirit/home/karma/numeric/detail/numeric_utils.hpp:130:
instantiated from here
boost/boost/math/tools/promotion.hpp:141: error: invalid application
of 'sizeof' to incomplete type
'boost::STATIC_ASSERTION_FAILURE<false>'
I.e., the compilation fails because FreeBSD doesn't supprt "long double" type.
This happens now due to the following changes in
boost/math/special_functions/sign.hpp :
123 template<class T> int (signbit)(T x)
124 {
125 typedef typename detail::fp_traits<T>::type traits;
126 typedef typename traits::method method;
127 - typedef typename boost::is_floating_point<T>::type fp_tag;
128 - return detail::signbit_impl(x, method());
127 + // typedef typename boost::is_floating_point<T>::type fp_tag;
128 + typedef typename tools::promote_args<T>::type result_type;
129 + return detail::signbit_impl(static_cast<result_type>(x), method());
130 }
So, what would be the right way to reconcile karma and math?
Thanks,
Igor'.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net