$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r68922 - sandbox/guild/pool/libs/pool/test
From: john_at_[hidden]
Date: 2011-02-15 14:03:02
Author: johnmaddock
Date: 2011-02-15 14:03:00 EST (Tue, 15 Feb 2011)
New Revision: 68922
URL: http://svn.boost.org/trac/boost/changeset/68922
Log:
Add test case for issue #1252.
Refs #1252.
Added:
   sandbox/guild/pool/libs/pool/test/test_bug_1252.cpp   (contents, props changed)
Text files modified: 
   sandbox/guild/pool/libs/pool/test/Jamfile.v2 |     1 +                                       
   1 files changed, 1 insertions(+), 0 deletions(-)
Modified: sandbox/guild/pool/libs/pool/test/Jamfile.v2
==============================================================================
--- sandbox/guild/pool/libs/pool/test/Jamfile.v2	(original)
+++ sandbox/guild/pool/libs/pool/test/Jamfile.v2	2011-02-15 14:03:00 EST (Tue, 15 Feb 2011)
@@ -27,6 +27,7 @@
     [ run test_msvc_mem_leak_detect.cpp ]
     [ run test_bug_3349.cpp ]
     [ run test_bug_4960.cpp ]
+    [ run test_bug_1252.cpp ]
     ;
 
 
Added: sandbox/guild/pool/libs/pool/test/test_bug_1252.cpp
==============================================================================
--- (empty file)
+++ sandbox/guild/pool/libs/pool/test/test_bug_1252.cpp	2011-02-15 14:03:00 EST (Tue, 15 Feb 2011)
@@ -0,0 +1,36 @@
+/* Copyright (C) 2011 Kwan Ting Chan
+ * Based from bug report submitted by Xiaohan Wang
+ * 
+ * Use, modification and distribution is subject to the 
+ * Boost Software License, Version 1.0. (See accompanying
+ * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+ */
+
+// Test of bug #3349 (https://svn.boost.org/trac/boost/ticket/3349)
+
+#include <boost/pool/pool.hpp>
+
+struct limited_allocator_new_delete
+{
+  typedef std::size_t size_type; 
+  typedef std::ptrdiff_t difference_type; 
+
+  static char * malloc BOOST_PREVENT_MACRO_SUBSTITUTION(const size_type bytes)
+  { 
+     if(bytes > 2000)
+        return 0;
+     return new (std::nothrow) char[bytes];
+  }
+  static void free BOOST_PREVENT_MACRO_SUBSTITUTION(char * const block)
+  { 
+     delete [] block;
+  }
+};
+
+
+int main() 
+{
+  boost::pool<limited_allocator_new_delete> po(1501);
+  void* p = po.malloc();
+  return p == 0 ? 1 : 0;
+}