Boost C++ Libraries: Ticket #13577: rational_adaptor does not compile with fixed width cpp_int https://svn.boost.org/trac10/ticket/13577 <p> Hello, I am trying to use the <code>rational_adaptor</code> class with a 128-bit <code>cpp_int</code> as a fixed-width alternative to <code>cpp_rational</code>. However, attempting to do so results in a compiler error. </p> <pre class="wiki">#include &lt;boost/multiprecision/cpp_int.hpp&gt; using namespace boost::multiprecision; using Rational = number&lt;rational_adaptor&lt;cpp_int_backend&lt;128, 128, signed_magnitude, checked, void&gt;&gt;&gt;; int main() { Rational x = 3; x /= 2; } </pre><p> Compiling this program (Clang, Mac 10.12, Boost 1.67) results in the following error </p> <pre class="wiki">/usr/local/include/boost/multiprecision/rational_adaptor.hpp:268:11: error: no matching function for call to 'eval_is_zero' return eval_is_zero(val.data().numerator().backend()); ^~~~~~~~~~~~ /usr/local/include/boost/multiprecision/rational_adaptor.hpp:230:7: note: in instantiation of function template specialization 'boost::multiprecision::backends::eval_is_zero&lt;boost::multiprecision::backends::cpp_int_backend&lt;128, 128, boost::multiprecision::cpp_integer_type::signed_magnitude, boost::multiprecision::cpp_int_check_type::checked, void&gt; &gt;' requested here if(eval_is_zero(o)) ^ /usr/local/include/boost/multiprecision/detail/default_ops.hpp:154:4: note: in instantiation of function template specialization 'boost::multiprecision::backends::eval_divide&lt;boost::multiprecision::backends::cpp_int_backend&lt;128, 128, boost::multiprecision::cpp_integer_type::signed_magnitude, boost::multiprecision::cpp_int_check_type::checked, void&gt; &gt;' requested here eval_divide(result, t); ^ /usr/local/include/boost/multiprecision/number.hpp:447:7: note: in instantiation of function template specialization 'boost::multiprecision::default_ops::eval_divide&lt;boost::multiprecision::backends::rational_adaptor&lt;boost::multiprecision::backends::cpp_int_backend&lt;128, 128, boost::multiprecision::cpp_integer_type::signed_magnitude, boost::multiprecision::cpp_int_check_type::checked, void&gt; &gt;, int&gt;' requested here eval_divide(m_backend, canonical_value(v)); ^ bug2.cpp:9:7: note: in instantiation of function template specialization 'boost::multiprecision::number&lt;boost::multiprecision::backends::rational_adaptor&lt;boost::multiprecision::backends::cpp_int_backend&lt;128, 128, boost::multiprecision::cpp_integer_type::signed_magnitude, boost::multiprecision::cpp_int_check_type::checked, void&gt; &gt;, boost::multiprecision::expression_template_option::et_off&gt;::operator/=&lt;int&gt;' requested here x /= 2; ^ /usr/local/include/boost/multiprecision/rational_adaptor.hpp:266:13: note: candidate template ignored: could not match 'rational_adaptor' against 'cpp_int_backend' inline bool eval_is_zero(const rational_adaptor&lt;IntBackend&gt;&amp; val) ^ /usr/local/include/boost/multiprecision/cpp_int/misc.hpp:155:4: note: candidate template ignored: substitution failure [with MinBits1 = 128, MaxBits1 = 128, SignType1 = boost::multiprecision::cpp_integer_type::signed_magnitude, Checked1 = boost::multiprecision::cpp_int_check_type::checked, Allocator1 = void]: no type named 'type' in 'boost::enable_if_c&lt;false, bool&gt;' eval_is_zero(const cpp_int_backend&lt;MinBits1, MaxBits1, SignType1, Checked1, Allocator1&gt;&amp; val) BOOST_NOEXCEPT ^ 1 error generated. </pre><p> Is the <code>rational_adaptor</code> class intended for use with fixed-width integers, or just arbitrary precision ones? </p> <p> Thank you </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/13577 Trac 1.4.3 John Maddock Tue, 29 May 2018 17:24:44 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/13577#comment:1 https://svn.boost.org/trac10/ticket/13577#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> It's a bug. Fixed in <a class="ext-link" href="https://github.com/boostorg/multiprecision/commit/61f4fd8778074cbd78bceee739b5076846b75b23"><span class="icon">​</span>https://github.com/boostorg/multiprecision/commit/61f4fd8778074cbd78bceee739b5076846b75b23</a> </p> Ticket