summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_global_thread-3.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/testsuite/ext/mt_allocator/deallocate_global_thread-3.cc')
-rw-r--r--libstdc++-v3/testsuite/ext/mt_allocator/deallocate_global_thread-3.cc23
1 files changed, 14 insertions, 9 deletions
diff --git a/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_global_thread-3.cc b/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_global_thread-3.cc
index 398ef31d39d..d764d41c9a0 100644
--- a/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_global_thread-3.cc
+++ b/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_global_thread-3.cc
@@ -19,6 +19,7 @@
// 20.4.1.1 allocator members
+#include <list>
#include <string>
#include <stdexcept>
#include <ext/mt_allocator.h>
@@ -31,13 +32,15 @@ struct count_check
count_check() {}
~count_check()
{
-#ifdef _GLIBCXX_USE___CXA_ATEXIT
if (count != 0)
- throw std::runtime_error("count isn't zero");
-#endif
+ {
+ // NB: __mt_allocator doesn't clean itself up. Thus, this will
+ // not be zero.
+ }
}
};
+// First.
static count_check check;
void* operator new(size_t size) throw(std::bad_alloc)
@@ -63,15 +66,17 @@ void operator delete(void* p) throw()
free(p);
}
-typedef char char_t;
-typedef std::char_traits<char_t> traits_t;
-typedef __gnu_cxx::__per_type_pool_policy<char_t, true> pool_t;
-typedef __gnu_cxx::__mt_alloc<char_t, pool_t> allocator_t;
-typedef std::basic_string<char_t, traits_t, allocator_t> string_t;
+typedef std::string value_t;
+typedef __gnu_cxx::__per_type_pool_policy<value_t, true> policy_t;
+typedef __gnu_cxx::__mt_alloc<value_t, policy_t> allocator_t;
+typedef std::char_traits<value_t> traits_t;
+typedef std::list<value_t, allocator_t> list_t;
-string_t s("bayou bend");
+// Second.
+list_t l;
int main()
{
+ l.push_back("bayou bend");
return 0;
}