aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2016-08-01 13:45:47 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2016-08-01 13:45:47 +0100
commitcbcc9fe8b86cfec7b53f745c9bd976b8ea78eec3 (patch)
tree5e8160484362c23f6e749df48edb721e21dd3cf1
parent8204be6c83fafb7aaf42c4e3e8d6105a36e46fd2 (diff)
downloadgcc-cbcc9fe8b86cfec7b53f745c9bd976b8ea78eec3.zip
gcc-cbcc9fe8b86cfec7b53f745c9bd976b8ea78eec3.tar.gz
gcc-cbcc9fe8b86cfec7b53f745c9bd976b8ea78eec3.tar.bz2
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. From-SVN: r238952
-rw-r--r--libstdc++-v3/ChangeLog3
-rw-r--r--libstdc++-v3/testsuite/backward/hash_set/check_construct_destroy.cc26
2 files changed, 17 insertions, 12 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 94065d6..3db43ac 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,8 @@
2016-08-01 Jonathan Wakely <jwakely@redhat.com>
+ * 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 5740fe1..821cb29 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;
}