bug11922.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Copyright 2016 John Maddock. Distributed under the Boost
  3. // Software License, Version 1.0. (See accompanying file
  4. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. #include <boost/multiprecision/cpp_int.hpp>
  6. #include <memory>
  7. #if defined(__apple_build_version__) && (__clang_major__ < 9)
  8. //
  9. // Apples clang fails with:
  10. // error: no matching function for call to '__implicit_conversion_to'
  11. // Which is nothing to do with us really...
  12. //
  13. #define DISABLE_TEST
  14. #endif
  15. typedef boost::multiprecision::cpp_int mp_int;
  16. #if !defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS) && !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) && !defined(DISABLE_TEST)
  17. class Int1
  18. {
  19. public:
  20. Int1(const mp_int& i) {}
  21. Int1(const Int1& i) {}
  22. };
  23. class Int2
  24. {
  25. public:
  26. Int2(const mp_int& i) {}
  27. Int2(const Int2& i) = delete;
  28. };
  29. int main()
  30. {
  31. using namespace boost::multiprecision;
  32. mp_int i(10);
  33. Int1 a(i + 10);
  34. Int2 b(i + 20);
  35. #ifndef BOOST_NO_CXX11_SMART_PTR
  36. std::shared_ptr<Int1> p1 = std::make_shared<Int1>(i + 10);
  37. std::shared_ptr<Int2> p2 = std::make_shared<Int2>(i + 10);
  38. #endif
  39. return 0;
  40. }
  41. #else
  42. int main()
  43. {
  44. return 0;
  45. }
  46. #endif