id summary reporter owner description type status milestone component version severity resolution keywords cc 9497 mpq_rational asserts when used in variant András Kucsma John Maddock "The following code fails with an assertion: {{{#!C++ #include #include struct Foo { Foo() {} Foo(const Foo&) {} }; int main() { typedef boost::multiprecision::mpq_rational Num; typedef boost::variant Variant; Variant x = Num(2); Variant y = std::move(x); x = Foo(); } }}} Assert text: {{{ test: /usr/local/include/boost/multiprecision/gmp.hpp:1947: __mpq_struct (& boost::multiprecision::backends::gmp_rational::data())[1]: Assertion `m_data[0]._mp_num._mp_d' failed. Aborted }}} Some notes on the code: * The explicit copy constructor for Foo is necessary * Replacing mpq_rational with mpz_int or cpp_rational doesn't cause assertion * Using boost::move without the -std=c++11 flag doesn't assert. (but it does assert with -std=c++11) Tested on Linux with: * g++-4.8.1, g++-4.8.2, clang 3.5 (trunk 197340) * boost-1.55.0 and trunk revision: 86799 * libgmp 5.1.0 Compiled with the command: (clan)g++ -std=c++11 main.cpp /usr/local/lib/libgmp.a -O0 -g The source of the problem could very well be in how variant handles move semantics in C++11 mode. Note: you can also find this file here: https://gist.github.com/r0mai/7978397" Bugs closed To Be Determined multiprecision Boost 1.55.0 Problem fixed antoshkka@…