id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 11764,boost/multiprecision/number.hpp:52:17: error: no viable overloaded '=',Jeff Hammond ,John Maddock,"= Summary = The following simple program attempts to make use of simple features in Boost Multiprecision and Math. I have no problem using {{{constants::pi}}} with double, extended double, quad precision, or even a user-defined version of double double precision. However, when I try to get a single precision version of this constant, it fails. = Source Code = {{{ #include #include #include #include using boost::multiprecision::cpp_bin_float_single; using boost::multiprecision::cpp_bin_float_double; typedef boost::multiprecision::cpp_bin_float_single f32; typedef boost::multiprecision::cpp_bin_float_double f64; int main(void) { #if BUGTEST_PRECISION == 32 //f32 pi32 = boost::math::constants::pi > >(); f32 pi32 = boost::math::constants::pi(); std::cout << pi32 << std::endl; #elif BUGTEST_PRECISION == 64 //f64 pi64 = boost::math::constants::pi > >(); f64 pi64 = boost::math::constants::pi(); std::cout << pi64 << std::endl; #else #error Set BUGTEST_PRECISION to 32 or 64. #endif return 0; } }}} = Compilers Tested = Mac Yosemite (10.10.5): * Apple LLVM version 7.0.0 ({{{clang++}}}) * Clang 3.6.2 from Homebrew * GCC 4.2.1 ({g++}) * GCC 5.2.0 from Homebrew * Intel 16.0.0 = Representative Output = Clang and GCC show nearly identical errors. The Intel one is much shorter but seemingly equivalent. {{{ jrhammon-mac01:boost jrhammon$ clang++ -g -Wall -std=c++11 -stdlib=libc++ -DBUGTEST_PRECISION=64 bug.cc -o bug.x jrhammon-mac01:boost jrhammon$ clang++ -g -Wall -std=c++11 -stdlib=libc++ -DBUGTEST_PRECISION=32 bug.cc -o bug.x In file included from bug.cc:5: In file included from /usr/local/include/boost/multiprecision/cpp_bin_float.hpp:9: In file included from /usr/local/include/boost/multiprecision/cpp_int.hpp:12: /usr/local/include/boost/multiprecision/number.hpp:52:17: error: no viable overloaded '=' m_backend = canonical_value(v); ~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~ /usr/local/include/boost/math/constants/constants.hpp:289:3: note: in instantiation of function template specialization 'boost::multiprecision::number, boost::multiprecision::expression_template_option::et_off>::number' requested here BOOST_DEFINE_MATH_CONSTANT(pi, 3.141592653589793238462643383279502884e+00, ""3.141592653589793238462643383279502884197169... ^ /usr/local/include/boost/math/constants/constants.hpp:246:13: note: expanded from macro 'BOOST_DEFINE_MATH_CONSTANT' { return BOOST_JOIN(x, F); }\ ^ /usr/local/include/boost/config/suffix.hpp:544:28: note: expanded from macro 'BOOST_JOIN' #define BOOST_JOIN( X, Y ) BOOST_DO_JOIN( X, Y ) ^ /usr/local/include/boost/config/suffix.hpp:545:31: note: expanded from macro 'BOOST_DO_JOIN' #define BOOST_DO_JOIN( X, Y ) BOOST_DO_JOIN2(X,Y) ^ /usr/local/include/boost/config/suffix.hpp:546:32: note: expanded from macro 'BOOST_DO_JOIN2' #define BOOST_DO_JOIN2( X, Y ) X##Y ^ :14:1: note: expanded from here 3.141592653589793238462643383279502884e+00F ^ /usr/local/include/boost/multiprecision/cpp_bin_float.hpp:107:19: note: candidate function not viable: no known conversion from 'typename boost::disable_if >::type, float>, typename detail::canonical >::type>::type' (aka 'double') to 'const boost::multiprecision::backends::cpp_bin_float<24, boost::multiprecision::backends::digit_base_type::digit_base_2, void, short, -126, 127>' for 1st argument cpp_bin_float& operator=(const cpp_bin_float &o) BOOST_NOEXCEPT_IF(noexcept(std::declval() = std::declval >::type, float>, typename detail::canonical >::type>::type' (aka 'double') to 'const char *' for 1st argument cpp_bin_float& operator=(const char *s); ^ /usr/local/include/boost/multiprecision/cpp_bin_float.hpp:116:19: note: candidate template ignored: could not match 'cpp_bin_float' against 'double' cpp_bin_float& operator=(const cpp_bin_float &o) ^ /usr/local/include/boost/multiprecision/cpp_bin_float.hpp:129:74: note: candidate template ignored: substitution failure [with Float = double]: no type named 'type' in 'boost::enable_if_c &>' && (std::numeric_limits::radix == 2), cpp_bin_float&>::type operator=(const Float& f) ~~~~ ^ /usr/local/include/boost/multiprecision/cpp_bin_float.hpp:271:30: note: candidate template ignored: disabled by 'enable_if' [with I = double] typename boost::enable_if, cpp_bin_float&>::type operator=(const I& i) ^ 1 error generated. }}} ",Bugs,closed,To Be Determined,multiprecision,Boost 1.58.0,Problem,fixed,,