From 9f80782fce472f80322992606e95d81f43506a84 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Mon, 1 Aug 2016 12:45:47 +0000 Subject: Fix __gnu_cxx::hash_set test to pass in C++98 mode * testsuite/backward/hash_set/check_construct_destroy.cc: Account for different construct/destroy counts in C++98 mode. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@238952 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 3 +++ .../backward/hash_set/check_construct_destroy.cc | 26 ++++++++++++---------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 94065d6033f..3db43acc50f 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,8 @@ 2016-08-01 Jonathan Wakely + * testsuite/backward/hash_set/check_construct_destroy.cc: Account + for different construct/destroy counts in C++98 mode. + * testsuite/17_intro/freestanding.cc: Remove "-x c" from dg-options. * testsuite/20_util/tuple/cons/66338.cc: Limit test to C++11 and diff --git a/libstdc++-v3/testsuite/backward/hash_set/check_construct_destroy.cc b/libstdc++-v3/testsuite/backward/hash_set/check_construct_destroy.cc index 5740fe1bf8b..821cb29b411 100644 --- a/libstdc++-v3/testsuite/backward/hash_set/check_construct_destroy.cc +++ b/libstdc++-v3/testsuite/backward/hash_set/check_construct_destroy.cc @@ -39,48 +39,50 @@ int main() int buckets; - // Add 1 to all counts, because the std::vector used internally by the - // hashtable creates and destroys a temporary object using the allocator. + // For C++11 and later add 1 to all counts, because the std::vector used + // internally by the hashtable creates and destroys a temporary object + // using its allocator. + const int extra = __cplusplus >= 201102L ? 1 : 0; tracker_allocator_counter::reset(); { Container c; buckets = c.bucket_count(); - ok = check_construct_destroy("empty container", buckets+1, 1) && ok; + ok = check_construct_destroy("empty container", buckets+extra, extra) && ok; } - ok = check_construct_destroy("empty container", buckets+1, buckets+1) && ok; + ok = check_construct_destroy("empty container", buckets+extra, buckets+extra) && ok; tracker_allocator_counter::reset(); { Container c(arr10, arr10 + 10); - ok = check_construct_destroy("Construct from range", buckets+10+1, 1) && ok; + ok = check_construct_destroy("Construct from range", buckets+10+extra, extra) && ok; } - ok = check_construct_destroy("Construct from range", buckets+10+1, buckets+10+1) && ok; + ok = check_construct_destroy("Construct from range", buckets+10+extra, buckets+10+extra) && ok; tracker_allocator_counter::reset(); { Container c(arr10, arr10 + 10); c.insert(arr10a[0]); - ok = check_construct_destroy("Insert element", buckets+11+1, 1) && ok; + ok = check_construct_destroy("Insert element", buckets+11+extra, extra) && ok; } - ok = check_construct_destroy("Insert element", buckets+11+1, buckets+11+1) && ok; + ok = check_construct_destroy("Insert element", buckets+11+extra, buckets+11+extra) && ok; tracker_allocator_counter::reset(); { Container c(arr10, arr10 + 10); c.insert(arr10a, arr10a+3); - ok = check_construct_destroy("Insert short range", buckets+13+1, 1) && ok; + ok = check_construct_destroy("Insert short range", buckets+13+extra, extra) && ok; } - ok = check_construct_destroy("Insert short range", buckets+13+1, buckets+13+1) && ok; + ok = check_construct_destroy("Insert short range", buckets+13+extra, buckets+13+extra) && ok; tracker_allocator_counter::reset(); { Container c(arr10, arr10 + 10); c.insert(arr10a, arr10a+10); - ok = check_construct_destroy("Insert long range", buckets+20+1, 1) && ok; + ok = check_construct_destroy("Insert long range", buckets+20+extra, extra) && ok; } - ok = check_construct_destroy("Insert long range", buckets+20+1, buckets+20+1) && ok; + ok = check_construct_destroy("Insert long range", buckets+20+extra, buckets+20+extra) && ok; return ok ? 0 : 1; } -- cgit v1.2.3