]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/atomic/test/c_implicit_ctor.cpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / libs / atomic / test / c_implicit_ctor.cpp
CommitLineData
11fdf7f2
TL
1// Copyright (c) 2018 Andrey Semashev
2//
3// Distributed under the Boost Software License, Version 1.0.
4// See accompanying file LICENSE_1_0.txt or copy at
5// http://www.boost.org/LICENSE_1_0.txt)
6
7// The test verifies that atomic<T> has an implicit conversion constructor from T.
8// This can only be tested in C++17 because it has mandated copy elision. Previous C++ versions
9// also require atomic<> to have a copy or move constructor, which it does not.
10#if __cplusplus >= 201703L
11
12#include <boost/atomic.hpp>
13#include <boost/static_assert.hpp>
14#include <boost/config.hpp>
15#include <type_traits>
16
17int main(int, char *[])
18{
19 static_assert(std::is_convertible< int, boost::atomic< int > >::value, "boost::atomic<T> does not have an implicit constructor from T");
20
21 boost::atomic< short > a = 10;
22 (void)a;
23
24 return 0;
25}
26
27#else // __cplusplus >= 201703L
28
29int main(int, char *[])
30{
31 return 0;
32}
33
34#endif // __cplusplus >= 201703L