Boost C++ Libraries: Ticket #4139: gcd_integer in common_factor_rt.hpp fails to compile for some IntegerTypes (like mpz_class) https://svn.boost.org/trac10/ticket/4139 <p> The use of the ternary operator in gcd_integer in common_factor_rt.hpp:119 can lead to compile time error if the unary operator- of the given type doesn't return the same type as itself: </p> <p> return ( result &lt; zero ) ? -result : result; </p> <p> as the type of "-result" and "result" differs. </p> <p> Either a static_cast is needed like: </p> <p> return ( result &lt; zero ) ? static_cast&lt;<a class="missing wiki">IntegerType</a>&gt;(-result) : result; </p> <p> or the one-liner should be replaced with an if like this: </p> <blockquote> <p> if ( result &lt; zero ) { </p> <blockquote> <p> return -result; </p> </blockquote> <p> } else { </p> <blockquote> <p> return result; </p> </blockquote> <p> } </p> </blockquote> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4139 Trac 1.4.3 John Maddock Fri, 07 May 2010 15:36:11 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/4139#comment:1 https://svn.boost.org/trac10/ticket/4139#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> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/61837" title="Fix failures when used with an expression-template enabled number type ...">[61837]</a>) Fix failures when used with an expression-template enabled number type such as the gmpxx clases. Add additional concept check for integer code using gmp classes. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4139" title="#4139: Bugs: gcd_integer in common_factor_rt.hpp fails to compile for some ... (closed: fixed)">#4139</a>. </p> Ticket