]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/smart_ptr/test/make_unique_throws_test.cpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / smart_ptr / test / make_unique_throws_test.cpp
CommitLineData
7c673cae
FG
1/*
2(c) 2014 Glen Joseph Fernandes
3<glenjofe -at- gmail.com>
4
5Distributed under the Boost Software
6License, Version 1.0.
7http://boost.org/LICENSE_1_0.txt
8*/
9#include <boost/config.hpp>
10#if !defined(BOOST_NO_CXX11_SMART_PTR)
11#include <boost/detail/lightweight_test.hpp>
12#include <boost/smart_ptr/make_unique.hpp>
13
14class type {
15public:
16 static unsigned int instances;
17
18 explicit type() {
19 if (instances == 0) {
20 throw true;
21 }
22 instances++;
23 }
24
25 ~type() {
26 instances--;
27 }
28
29private:
30 type(const type&);
31 type& operator=(const type&);
32};
33
34unsigned int type::instances = 0;
35
36int main()
37{
38 BOOST_TEST(type::instances == 0);
39 try {
40 boost::make_unique<type>();
41 BOOST_ERROR("make_unique did not throw");
42 } catch (...) {
43 BOOST_TEST(type::instances == 0);
44 }
45
46 return boost::report_errors();
47}
48#else
49
50int main()
51{
52 return 0;
53}
54
55#endif