Index: boost/test/floating_point_comparison.hpp =================================================================== --- boost/test/floating_point_comparison.hpp (revision 49619) +++ boost/test/floating_point_comparison.hpp (working copy) @@ -79,17 +79,26 @@ safe_fpt_division( FPT f1, FPT f2 ) { // Avoid overflow. - if( f2 < static_cast(1) && f1 > f2*fpt_limits::max_value() ) + if( (f2 < static_cast(1)) && (f1 > f2*fpt_limits::max_value()) ) return fpt_limits::max_value(); // Avoid underflow. - if( f1 == static_cast(0) || - f2 > static_cast(1) && f1 < f2*fpt_limits::min_value() ) + if( (f1 == static_cast(0)) || + ((f2 > static_cast(1)) && (f1 < f2*fpt_limits::min_value())) ) return static_cast(0); return f1/f2; } +// helper templates to prevent ODR violations +template +struct static_constant { + static T value; +}; + +template +T static_constant::value; + //____________________________________________________________________________// } // namespace tt_detail @@ -221,7 +230,7 @@ }; namespace { -check_is_close_t check_is_close; +const check_is_close_t& check_is_close = tt_detail::static_constant::value; } //____________________________________________________________________________// @@ -243,7 +252,7 @@ }; namespace { -check_is_small_t check_is_small; +const check_is_small_t& check_is_small = tt_detail::static_constant::value; } //____________________________________________________________________________//