summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libcxx/include/deque3
-rw-r--r--libcxx/include/forward_list3
-rw-r--r--libcxx/include/map6
-rw-r--r--libcxx/include/set6
-rw-r--r--libcxx/test/std/containers/associative/map/allocator_mismatch.fail.cpp18
-rw-r--r--libcxx/test/std/containers/associative/multimap/allocator_mismatch.fail.cpp18
-rw-r--r--libcxx/test/std/containers/associative/multiset/allocator_mismatch.fail.cpp18
-rw-r--r--libcxx/test/std/containers/associative/set/allocator_mismatch.fail.cpp18
-rw-r--r--libcxx/test/std/containers/sequences/deque/allocator_mismatch.fail.cpp18
-rw-r--r--libcxx/test/std/containers/sequences/forwardlist/allocator_mismatch.fail.cpp18
-rw-r--r--libcxx/test/std/containers/sequences/list/allocator_mismatch.fail.cpp18
-rw-r--r--libcxx/test/std/containers/sequences/vector/allocator_mismatch.fail.cpp18
-rw-r--r--libcxx/test/std/containers/unord/unord.map/allocator_mismatch.fail.cpp18
-rw-r--r--libcxx/test/std/containers/unord/unord.multimap/allocator_mismatch.fail.cpp18
-rw-r--r--libcxx/test/std/containers/unord/unord.multiset/allocator_mismatch.fail.cpp18
-rw-r--r--libcxx/test/std/containers/unord/unord.set/allocator_mismatch.fail.cpp18
-rw-r--r--libcxx/test/std/strings/basic.string/allocator_mismatch.fail.cpp18
17 files changed, 252 insertions, 0 deletions
diff --git a/libcxx/include/deque b/libcxx/include/deque
index b0b778a56ce..c6fbd512a1c 100644
--- a/libcxx/include/deque
+++ b/libcxx/include/deque
@@ -1196,6 +1196,9 @@ public:
typedef _Tp value_type;
typedef _Allocator allocator_type;
+ static_assert((is_same<typename allocator_type::value_type, value_type>::value),
+ "Allocator::value_type must be same type as value_type");
+
typedef __deque_base<value_type, allocator_type> __base;
typedef typename __base::__alloc_traits __alloc_traits;
diff --git a/libcxx/include/forward_list b/libcxx/include/forward_list
index 8a87fc5e1f2..adbc32cf861 100644
--- a/libcxx/include/forward_list
+++ b/libcxx/include/forward_list
@@ -537,6 +537,9 @@ public:
typedef _Tp value_type;
typedef _Alloc allocator_type;
+ static_assert((is_same<typename allocator_type::value_type, value_type>::value),
+ "Allocator::value_type must be same type as value_type");
+
typedef value_type& reference;
typedef const value_type& const_reference;
typedef typename allocator_traits<allocator_type>::pointer pointer;
diff --git a/libcxx/include/map b/libcxx/include/map
index 561c3ddc93d..adfb4cdb5e9 100644
--- a/libcxx/include/map
+++ b/libcxx/include/map
@@ -840,6 +840,9 @@ public:
typedef value_type& reference;
typedef const value_type& const_reference;
+ static_assert((is_same<typename allocator_type::value_type, value_type>::value),
+ "Allocator::value_type must be same type as value_type");
+
class _LIBCPP_TYPE_VIS_ONLY value_compare
: public binary_function<value_type, value_type, bool>
{
@@ -1696,6 +1699,9 @@ public:
typedef value_type& reference;
typedef const value_type& const_reference;
+ static_assert((is_same<typename allocator_type::value_type, value_type>::value),
+ "Allocator::value_type must be same type as value_type");
+
class _LIBCPP_TYPE_VIS_ONLY value_compare
: public binary_function<value_type, value_type, bool>
{
diff --git a/libcxx/include/set b/libcxx/include/set
index 9d64a521da1..ac69e085241 100644
--- a/libcxx/include/set
+++ b/libcxx/include/set
@@ -409,6 +409,9 @@ public:
typedef value_type& reference;
typedef const value_type& const_reference;
+ static_assert((is_same<typename allocator_type::value_type, value_type>::value),
+ "Allocator::value_type must be same type as value_type");
+
private:
typedef __tree<value_type, value_compare, allocator_type> __base;
typedef allocator_traits<allocator_type> __alloc_traits;
@@ -819,6 +822,9 @@ public:
typedef value_type& reference;
typedef const value_type& const_reference;
+ static_assert((is_same<typename allocator_type::value_type, value_type>::value),
+ "Allocator::value_type must be same type as value_type");
+
private:
typedef __tree<value_type, value_compare, allocator_type> __base;
typedef allocator_traits<allocator_type> __alloc_traits;
diff --git a/libcxx/test/std/containers/associative/map/allocator_mismatch.fail.cpp b/libcxx/test/std/containers/associative/map/allocator_mismatch.fail.cpp
new file mode 100644
index 00000000000..f5da14539c4
--- /dev/null
+++ b/libcxx/test/std/containers/associative/map/allocator_mismatch.fail.cpp
@@ -0,0 +1,18 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+// The container's value type must be the same as the allocator's value type
+
+#include <map>
+
+int main()
+{
+ std::map<int, int, std::less<int>, std::allocator<long> > m;
+}
diff --git a/libcxx/test/std/containers/associative/multimap/allocator_mismatch.fail.cpp b/libcxx/test/std/containers/associative/multimap/allocator_mismatch.fail.cpp
new file mode 100644
index 00000000000..18823212f40
--- /dev/null
+++ b/libcxx/test/std/containers/associative/multimap/allocator_mismatch.fail.cpp
@@ -0,0 +1,18 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+// The container's value type must be the same as the allocator's value type
+
+#include <map>
+
+int main()
+{
+ std::multimap<int, int, std::less<int>, std::allocator<long> > m;
+}
diff --git a/libcxx/test/std/containers/associative/multiset/allocator_mismatch.fail.cpp b/libcxx/test/std/containers/associative/multiset/allocator_mismatch.fail.cpp
new file mode 100644
index 00000000000..b2b30d6fdc1
--- /dev/null
+++ b/libcxx/test/std/containers/associative/multiset/allocator_mismatch.fail.cpp
@@ -0,0 +1,18 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+// The container's value type must be the same as the allocator's value type
+
+#include <set>
+
+int main()
+{
+ std::multiset<int, std::less<int>, std::allocator<long> > ms;
+}
diff --git a/libcxx/test/std/containers/associative/set/allocator_mismatch.fail.cpp b/libcxx/test/std/containers/associative/set/allocator_mismatch.fail.cpp
new file mode 100644
index 00000000000..6905d934486
--- /dev/null
+++ b/libcxx/test/std/containers/associative/set/allocator_mismatch.fail.cpp
@@ -0,0 +1,18 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+// The container's value type must be the same as the allocator's value type
+
+#include <set>
+
+int main()
+{
+ std::set<int, std::less<int>, std::allocator<long> > s;
+}
diff --git a/libcxx/test/std/containers/sequences/deque/allocator_mismatch.fail.cpp b/libcxx/test/std/containers/sequences/deque/allocator_mismatch.fail.cpp
new file mode 100644
index 00000000000..9223c1ecddc
--- /dev/null
+++ b/libcxx/test/std/containers/sequences/deque/allocator_mismatch.fail.cpp
@@ -0,0 +1,18 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+// The container's value type must be the same as the allocator's value type
+
+#include <deque>
+
+int main()
+{
+ std::deque<int, std::allocator<long> > d;
+}
diff --git a/libcxx/test/std/containers/sequences/forwardlist/allocator_mismatch.fail.cpp b/libcxx/test/std/containers/sequences/forwardlist/allocator_mismatch.fail.cpp
new file mode 100644
index 00000000000..b53075d033b
--- /dev/null
+++ b/libcxx/test/std/containers/sequences/forwardlist/allocator_mismatch.fail.cpp
@@ -0,0 +1,18 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+// The container's value type must be the same as the allocator's value type
+
+#include <forward_list>
+
+int main()
+{
+ std::forward_list<int, std::allocator<long> > fl;
+}
diff --git a/libcxx/test/std/containers/sequences/list/allocator_mismatch.fail.cpp b/libcxx/test/std/containers/sequences/list/allocator_mismatch.fail.cpp
new file mode 100644
index 00000000000..3490d106a60
--- /dev/null
+++ b/libcxx/test/std/containers/sequences/list/allocator_mismatch.fail.cpp
@@ -0,0 +1,18 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+// The container's value type must be the same as the allocator's value type
+
+#include <list>
+
+int main()
+{
+ std::list<int, std::allocator<long> > l;
+}
diff --git a/libcxx/test/std/containers/sequences/vector/allocator_mismatch.fail.cpp b/libcxx/test/std/containers/sequences/vector/allocator_mismatch.fail.cpp
new file mode 100644
index 00000000000..65fdb63ee6a
--- /dev/null
+++ b/libcxx/test/std/containers/sequences/vector/allocator_mismatch.fail.cpp
@@ -0,0 +1,18 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <vector>
+// The container's value type must be the same as the allocator's value type
+
+#include <vector>
+
+int main()
+{
+ std::vector<int, std::allocator<long> > v;
+}
diff --git a/libcxx/test/std/containers/unord/unord.map/allocator_mismatch.fail.cpp b/libcxx/test/std/containers/unord/unord.map/allocator_mismatch.fail.cpp
new file mode 100644
index 00000000000..39fcb11add4
--- /dev/null
+++ b/libcxx/test/std/containers/unord/unord.map/allocator_mismatch.fail.cpp
@@ -0,0 +1,18 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_map>
+// The container's value type must be the same as the allocator's value type
+
+#include <unordered_map>
+
+int main()
+{
+ std::unordered_map<int, int, std::hash<int>, std::less<int>, std::allocator<long> > m;
+}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/allocator_mismatch.fail.cpp b/libcxx/test/std/containers/unord/unord.multimap/allocator_mismatch.fail.cpp
new file mode 100644
index 00000000000..3c740950d04
--- /dev/null
+++ b/libcxx/test/std/containers/unord/unord.multimap/allocator_mismatch.fail.cpp
@@ -0,0 +1,18 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_map>
+// The container's value type must be the same as the allocator's value type
+
+#include <unordered_map>
+
+int main()
+{
+ std::unordered_multimap<int, int, std::hash<int>, std::less<int>, std::allocator<long> > m;
+}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/allocator_mismatch.fail.cpp b/libcxx/test/std/containers/unord/unord.multiset/allocator_mismatch.fail.cpp
new file mode 100644
index 00000000000..5836cb36615
--- /dev/null
+++ b/libcxx/test/std/containers/unord/unord.multiset/allocator_mismatch.fail.cpp
@@ -0,0 +1,18 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+// The container's value type must be the same as the allocator's value type
+
+#include <unordered_set>
+
+int main()
+{
+ std::unordered_multiset<int, std::hash<int>, std::less<int>, std::allocator<long> > v;
+}
diff --git a/libcxx/test/std/containers/unord/unord.set/allocator_mismatch.fail.cpp b/libcxx/test/std/containers/unord/unord.set/allocator_mismatch.fail.cpp
new file mode 100644
index 00000000000..b87c9a24d3a
--- /dev/null
+++ b/libcxx/test/std/containers/unord/unord.set/allocator_mismatch.fail.cpp
@@ -0,0 +1,18 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+// The container's value type must be the same as the allocator's value type
+
+#include <unordered_set>
+
+int main()
+{
+ std::unordered_set<int, std::hash<int>, std::less<int>, std::allocator<long> > v;
+}
diff --git a/libcxx/test/std/strings/basic.string/allocator_mismatch.fail.cpp b/libcxx/test/std/strings/basic.string/allocator_mismatch.fail.cpp
new file mode 100644
index 00000000000..644137ec257
--- /dev/null
+++ b/libcxx/test/std/strings/basic.string/allocator_mismatch.fail.cpp
@@ -0,0 +1,18 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+// The container's value type must be the same as the allocator's value type
+
+#include <string>
+
+int main()
+{
+ std::basic_string<char, std::char_traits<char>, std::allocator<int> > s;
+}
OpenPOWER on IntegriCloud