OSDN Git Service

2004-10-20 Paolo Carlini <pcarlini@suse.de>
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / testsuite / testsuite_allocator.h
index c10be53..7c35344 100644 (file)
@@ -36,6 +36,7 @@
 #define _GLIBCXX_TESTSUITE_ALLOCATOR_H
 
 #include <cstddef>
+#include <cstdlib>
 #include <limits>
 
 namespace 
@@ -205,7 +206,27 @@ namespace __gnu_test
       a.deallocate(NULL, 1);
       a.deallocate(NULL, 10);
     }
+
+  template<typename Alloc>
+    bool 
+    check_allocate_max_size()
+    {
+      Alloc a;
+      try
+       {
+         a.allocate(a.max_size() + 1);
+       }
+      catch(std::bad_alloc&)
+       {
+         return true;
+       }
+      catch(...)
+       {
+         throw;
+       }
+      throw;
+    }
+
 }; // namespace __gnu_test
 
 #endif // _GLIBCXX_TESTSUITE_ALLOCATOR_H
-