]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/pool/test/test_bug_5526.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / pool / test / test_bug_5526.cpp
1 /* Copyright (C) 2011 John Maddock
2 *
3 * Use, modification and distribution is subject to the
4 * Boost Software License, Version 1.0. (See accompanying
5 * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
6 */
7
8 // Test of bug #5526 (https://svn.boost.org/trac/boost/ticket/5526)
9
10 #include <boost/smart_ptr/scoped_ptr.hpp>
11 #include <boost/pool/pool.hpp>
12 #include <boost/pool/singleton_pool.hpp>
13 #include <boost/assert.hpp>
14
15 struct bad
16 {
17 bad()
18 {
19 buf = static_cast<int*>(boost::singleton_pool<int, sizeof(int)>::malloc());
20 *buf = 0x1234;
21 }
22 ~bad()
23 {
24 BOOST_ASSERT(*buf == 0x1234);
25 boost::singleton_pool<int, sizeof(int)>::free(buf);
26 }
27 int* buf;
28 };
29
30 boost::scoped_ptr<bad> aptr;
31
32 int main()
33 {
34 aptr.reset(new bad());
35 return 0;
36 }