summaryrefslogtreecommitdiffstats
path: root/libcxx/test/containers/associative
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2014-02-08 04:03:14 +0000
committerMarshall Clow <mclow.lists@gmail.com>2014-02-08 04:03:14 +0000
commit74cf6ff5e523fa972af797a7a05f9d9b3dddfb5a (patch)
tree0257a93fc4a9ee7911e7fa76aa482475b5a887ae /libcxx/test/containers/associative
parent57420b320cd989b49e6a458b129b3262834ad589 (diff)
downloadbcm5719-llvm-74cf6ff5e523fa972af797a7a05f9d9b3dddfb5a.tar.gz
bcm5719-llvm-74cf6ff5e523fa972af797a7a05f9d9b3dddfb5a.zip
Fix for PR18735 - self-assignment for map/multimap gives incorrect results in C++03
llvm-svn: 201021
Diffstat (limited to 'libcxx/test/containers/associative')
-rw-r--r--libcxx/test/containers/associative/map/map.cons/copy_assign.pass.cpp15
-rw-r--r--libcxx/test/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp20
-rw-r--r--libcxx/test/containers/associative/multiset/multiset.cons/copy_assign.pass.cpp20
-rw-r--r--libcxx/test/containers/associative/set/set.cons/copy_assign.pass.cpp15
4 files changed, 70 insertions, 0 deletions
diff --git a/libcxx/test/containers/associative/map/map.cons/copy_assign.pass.cpp b/libcxx/test/containers/associative/map/map.cons/copy_assign.pass.cpp
index ac05e291067..a1bcb30f429 100644
--- a/libcxx/test/containers/associative/map/map.cons/copy_assign.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.cons/copy_assign.pass.cpp
@@ -59,6 +59,21 @@ int main()
}
{
typedef std::pair<const int, double> V;
+ const V ar[] =
+ {
+ V(1, 1),
+ V(2, 1),
+ V(3, 1),
+ };
+ std::map<int, double> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ std::map<int, double> *p = &m;
+ m = *p;
+
+ assert(m.size() == 3);
+ assert(std::equal(m.begin(), m.end(), ar));
+ }
+ {
+ typedef std::pair<const int, double> V;
V ar[] =
{
V(1, 1),
diff --git a/libcxx/test/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp b/libcxx/test/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp
index f00f0fed166..2bdc4d6a70a 100644
--- a/libcxx/test/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp
@@ -50,6 +50,26 @@ int main()
}
{
typedef std::pair<const int, double> V;
+ const V ar[] =
+ {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ };
+ std::multimap<int, double> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ std::multimap<int, double> *p = &m;
+ m = *p;
+ assert(m.size() == sizeof(ar)/sizeof(ar[0]));
+ assert(std::equal(m.begin(), m.end(), ar));
+ }
+ {
+ typedef std::pair<const int, double> V;
V ar[] =
{
V(1, 1),
diff --git a/libcxx/test/containers/associative/multiset/multiset.cons/copy_assign.pass.cpp b/libcxx/test/containers/associative/multiset/multiset.cons/copy_assign.pass.cpp
index 19bdd713e9f..cca636325ff 100644
--- a/libcxx/test/containers/associative/multiset/multiset.cons/copy_assign.pass.cpp
+++ b/libcxx/test/containers/associative/multiset/multiset.cons/copy_assign.pass.cpp
@@ -70,6 +70,26 @@ int main()
}
{
typedef int V;
+ const V ar[] =
+ {
+ 1,
+ 1,
+ 1,
+ 2,
+ 2,
+ 2,
+ 3,
+ 3,
+ 3
+ };
+ std::multiset<int> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ std::multiset<int> *p = &m;
+ m = *p;
+ assert(m.size() == 9);
+ assert(std::equal(m.begin(), m.end(), ar));
+ }
+ {
+ typedef int V;
V ar[] =
{
1,
diff --git a/libcxx/test/containers/associative/set/set.cons/copy_assign.pass.cpp b/libcxx/test/containers/associative/set/set.cons/copy_assign.pass.cpp
index ae83eb3c9f8..7f0f0447625 100644
--- a/libcxx/test/containers/associative/set/set.cons/copy_assign.pass.cpp
+++ b/libcxx/test/containers/associative/set/set.cons/copy_assign.pass.cpp
@@ -58,6 +58,21 @@ int main()
}
{
typedef int V;
+ const V ar[] =
+ {
+ 1,
+ 2,
+ 3
+ };
+ std::set<int> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ std::set<int> *p = &m;
+ m = *p;
+
+ assert(m.size() == 3);
+ assert(std::equal(m.begin(), m.end(), ar));
+ }
+ {
+ typedef int V;
V ar[] =
{
1,
OpenPOWER on IntegriCloud