]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/type_traits/test/is_list_constructible_test.cpp
2 // Copyright 2017 Peter Dimov
4 // Distributed under the Boost Software License, Version 1.0.
5 // See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt
8 #if defined( __GNUC__ ) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 407)
9 #pragma GCC diagnostic ignored "-Wnarrowing"
10 #pragma GCC diagnostic ignored "-Wmissing-field-initializers"
14 # include <type_traits>
16 # include <boost/type_traits/is_list_constructible.hpp>
19 #include "check_integral_constant.hpp"
21 #if defined(BOOST_NO_SFINAE_EXPR) || defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_NO_CXX11_DECLTYPE) \
22 || defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) || defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS)\
23 || BOOST_WORKAROUND(BOOST_GCC, < 40700)
39 Y( int = 0, int = 0 );
44 explicit Z( int = 0, int = 0 );
52 TT_TEST_BEGIN(is_list_constructible
)
54 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_list_constructible
<int>::value
), true);
55 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_list_constructible
<int, int>::value
), true);
56 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_list_constructible
<int, int const>::value
), true);
57 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_list_constructible
<int, int, int>::value
), false);
58 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_list_constructible
<int, char>::value
), true);
60 #if defined(CI_SUPPRESS_KNOWN_ISSUES) && defined(__GNUC__) && (__GNUC__ == 4)
61 // g++ 4.x doesn't seem to disallow narrowing
63 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_list_constructible
<int, float>::value
), false);
66 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_list_constructible
<X
>::value
), true);
67 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_list_constructible
<X
, int>::value
), true);
68 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_list_constructible
<X
, int const>::value
), true);
69 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_list_constructible
<X
, int, int>::value
), true);
70 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_list_constructible
<X
, int const, int const>::value
), true);
71 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_list_constructible
<X
, int, int, int>::value
), false);
73 #if defined(CI_SUPPRESS_KNOWN_ISSUES) && defined(__GNUC__) && (__GNUC__ == 4)
74 // g++ 4.x doesn't seem to disallow narrowing
76 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_list_constructible
<X
, float>::value
), false);
77 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_list_constructible
<X
, int, float>::value
), false);
80 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_list_constructible
<Y
>::value
), true);
81 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_list_constructible
<Y
, int>::value
), true);
82 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_list_constructible
<Y
, int const>::value
), true);
83 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_list_constructible
<Y
, int, int>::value
), true);
84 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_list_constructible
<Y
, int const, int const>::value
), true);
85 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_list_constructible
<Y
, int, int, int>::value
), false);
87 #if defined(CI_SUPPRESS_KNOWN_ISSUES) && defined(__GNUC__) && (__GNUC__ == 4)
88 // g++ 4.x doesn't seem to disallow narrowing
89 #elif defined(CI_SUPPRESS_KNOWN_ISSUES) && defined(__GNUC__) && (__GNUC__ == 7) && (__cplusplus >= 201500)
90 // g++ 7.1 in -std=c++1z, c++17 has a bug
91 #elif defined(__NVCC__)
92 // nvcc in -std=c++17 mode has this issue.
94 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_list_constructible
<Y
, float>::value
), false);
95 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_list_constructible
<Y
, int, float>::value
), false);
98 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_list_constructible
<Z
>::value
), true);
99 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_list_constructible
<Z
, int>::value
), true);
100 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_list_constructible
<Z
, int const>::value
), true);
101 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_list_constructible
<Z
, int, int>::value
), true);
102 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_list_constructible
<Z
, int const, int const>::value
), true);
103 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_list_constructible
<Z
, int, int, int>::value
), false);
105 #if defined(CI_SUPPRESS_KNOWN_ISSUES) && defined(__GNUC__) && (__GNUC__ == 4)
106 // g++ 4.x doesn't seem to disallow narrowing
107 #elif defined(CI_SUPPRESS_KNOWN_ISSUES) && defined(__GNUC__) && (__GNUC__ == 7) && (__cplusplus >= 201500)
108 // g++ 7.1 in -std=c++1z, c++17 has a bug
109 #elif defined(__NVCC__)
110 // nvcc in -std=c++17 mode has this issue.
112 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_list_constructible
<Z
, float>::value
), false);
113 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_list_constructible
<Z
, int, float>::value
), false);
116 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_list_constructible
<V
>::value
), false);
117 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_list_constructible
<V
, int>::value
), false);
118 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_list_constructible
<V
, int, int>::value
), false);
119 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_list_constructible
<V
, int, int, int>::value
), false);
120 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_list_constructible
<V
, int&, int&>::value
), true);
121 BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_list_constructible
<V
, int const&, int const&>::value
), false);