• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
6 #include <boost/multiprecision/cpp_int.hpp>
7 #include <memory>
8 
9 #if defined(__apple_build_version__) && (__clang_major__ < 9)
10 //
11 // Apples clang fails with:
12 // error: no matching function for call to '__implicit_conversion_to'
13 // Which is nothing to do with us really...
14 //
15 #define DISABLE_TEST
16 #endif
17 
18 typedef boost::multiprecision::cpp_int mp_int;
19 
20 #if !defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS) && !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) && !defined(DISABLE_TEST)
21 
22 class Int1
23 {
24  public:
Int1(const mp_int &)25    Int1(const mp_int& ) {}
Int1(const Int1 &)26    Int1(const Int1& ) {}
27 };
28 
29 class Int2
30 {
31  public:
Int2(const mp_int &)32    Int2(const mp_int& ) {}
33    Int2(const Int2& ) = delete;
34 };
35 
main()36 int main()
37 {
38    using namespace boost::multiprecision;
39 
40    mp_int i(10);
41    Int1   a(i + 10);
42    Int2   b(i + 20);
43 
44 #ifndef BOOST_NO_CXX11_SMART_PTR
45 
46    std::shared_ptr<Int1> p1 = std::make_shared<Int1>(i + 10);
47    std::shared_ptr<Int2> p2 = std::make_shared<Int2>(i + 10);
48 
49 #endif
50 
51    return 0;
52 }
53 
54 #else
55 
main()56 int main()
57 {
58    return 0;
59 }
60 
61 #endif
62