1 ///////////////////////////////////////////////////////////////////////////////
2 // Copyright 2012 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 #if defined(HAVE_FLOAT128)
8 #include <boost/multiprecision/float128.hpp>
9 #endif
10
11 #ifndef BOOST_NO_CXX11_CONSTEXPR
12
13 template <class T>
silence_unused(const T &)14 void silence_unused(const T&) {}
15
16 template <class T>
test1()17 void test1()
18 {
19 constexpr T i1 = 2u;
20 constexpr T i2;
21 constexpr T i3 = -3;
22 constexpr T i4(i1);
23
24 silence_unused(i1);
25 silence_unused(i2);
26 silence_unused(i3);
27 silence_unused(i4);
28 }
29 template <class T>
test2()30 void test2()
31 {
32 constexpr T i1 = 2u;
33 constexpr T i2;
34 constexpr T i3 = -3;
35
36 silence_unused(i1);
37 silence_unused(i2);
38 silence_unused(i3);
39 }
40 template <class T>
test3()41 void test3()
42 {
43 constexpr T i1 = 2u;
44 constexpr T i2;
45
46 silence_unused(i1);
47 silence_unused(i2);
48 }
49
50 using namespace boost::multiprecision;
51
52 template void test1<number<cpp_int_backend<64, 64, unsigned_magnitude, unchecked, void>, et_off> >();
53 template void test1<number<cpp_int_backend<64, 64, signed_magnitude, unchecked, void>, et_off> >();
54 template void test3<number<cpp_int_backend<2048, 2048, unsigned_magnitude, unchecked, void>, et_off> >();
55 template void test2<number<cpp_int_backend<2048, 2048, signed_magnitude, unchecked, void>, et_off> >();
56
57 #if defined(HAVE_FLOAT128)
58 template void test1<float128>();
59 #endif
60
61 #endif
62