summaryrefslogtreecommitdiffstats
path: root/libcxx
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx')
-rw-r--r--libcxx/include/__hash_table4
-rw-r--r--libcxx/include/__tree2
-rw-r--r--libcxx/test/std/containers/associative/map/map.cons/compare_copy_constructible.fail.cpp29
-rw-r--r--libcxx/test/std/containers/associative/multimap/multimap.cons/compare_copy_constructible.fail.cpp29
-rw-r--r--libcxx/test/std/containers/associative/multiset/multiset.cons/compare_copy_constructible.fail.cpp29
-rw-r--r--libcxx/test/std/containers/associative/set/set.cons/compare_copy_constructible.fail.cpp29
-rw-r--r--libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/compare_copy_constructible.fail.cpp29
-rw-r--r--libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/hash_copy_constructible.fail.cpp29
-rw-r--r--libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/compare_copy_constructible.fail.cpp29
-rw-r--r--libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/hash_copy_constructible.fail.cpp29
-rw-r--r--libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/compare_copy_constructible.fail.cpp29
-rw-r--r--libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/hash_copy_constructible.fail.cpp29
-rw-r--r--libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/compare_copy_constructible.fail.cpp29
-rw-r--r--libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/hash_copy_constructible.fail.cpp29
-rw-r--r--libcxx/www/cxx1z_status.html2
15 files changed, 355 insertions, 1 deletions
diff --git a/libcxx/include/__hash_table b/libcxx/include/__hash_table
index 13ab928e16f..86cd9315dd7 100644
--- a/libcxx/include/__hash_table
+++ b/libcxx/include/__hash_table
@@ -938,6 +938,10 @@ private:
typedef allocator_traits<__node_base_allocator> __node_base_traits;
static_assert((is_same<__node_base_pointer, typename __node_base_traits::pointer>::value),
"Allocator does not rebind pointers in a sane manner.");
+ static_assert((is_copy_constructible<key_equal>::value),
+ "Predicate must be copy-constructible.");
+ static_assert((is_copy_constructible<hasher>::value),
+ "Hasher must be copy-constructible.");
private:
diff --git a/libcxx/include/__tree b/libcxx/include/__tree
index 89707e38fdd..e4863a02a56 100644
--- a/libcxx/include/__tree
+++ b/libcxx/include/__tree
@@ -946,6 +946,8 @@ private:
typedef allocator_traits<__node_base_allocator> __node_base_traits;
static_assert((is_same<__node_base_pointer, typename __node_base_traits::pointer>::value),
"Allocator does not rebind pointers in a sane manner.");
+ static_assert((is_copy_constructible<value_compare>::value),
+ "Comparator must be copy-constructible.");
private:
__node_pointer __begin_node_;
diff --git a/libcxx/test/std/containers/associative/map/map.cons/compare_copy_constructible.fail.cpp b/libcxx/test/std/containers/associative/map/map.cons/compare_copy_constructible.fail.cpp
new file mode 100644
index 00000000000..81ccba3bbc9
--- /dev/null
+++ b/libcxx/test/std/containers/associative/map/map.cons/compare_copy_constructible.fail.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// 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>
+
+// Check that std::map fails to instantiate if the comparison predicate is
+// not copy-constructible. This is LWG issue 2436
+
+#include <map>
+
+template <class T>
+struct Comp {
+ bool operator () (const T& lhs, const T& rhs) const { return lhs < rhs; }
+
+ Comp () {}
+private:
+ Comp (const Comp &); // declared but not defined
+ };
+
+
+int main() {
+ std::map<int, int, Comp<int> > m;
+}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.cons/compare_copy_constructible.fail.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/compare_copy_constructible.fail.cpp
new file mode 100644
index 00000000000..e6f6c3efee5
--- /dev/null
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/compare_copy_constructible.fail.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// 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>
+
+// Check that std::multimap fails to instantiate if the comparison predicate is
+// not copy-constructible. This is LWG issue 2436
+
+#include <map>
+
+template <class T>
+struct Comp {
+ bool operator () (const T& lhs, const T& rhs) const { return lhs < rhs; }
+
+ Comp () {}
+private:
+ Comp (const Comp &); // declared but not defined
+ };
+
+
+int main() {
+ std::multimap<int, int, Comp<int> > m;
+}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/compare_copy_constructible.fail.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/compare_copy_constructible.fail.cpp
new file mode 100644
index 00000000000..2eade5299d6
--- /dev/null
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/compare_copy_constructible.fail.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// 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>
+
+// Check that std::multiset fails to instantiate if the comparison predicate is
+// not copy-constructible. This is LWG issue 2436
+
+#include <set>
+
+template <class T>
+struct Comp {
+ bool operator () (const T& lhs, const T& rhs) const { return lhs < rhs; }
+
+ Comp () {}
+private:
+ Comp (const Comp &); // declared but not defined
+ };
+
+
+int main() {
+ std::multiset<int, Comp<int> > m;
+}
diff --git a/libcxx/test/std/containers/associative/set/set.cons/compare_copy_constructible.fail.cpp b/libcxx/test/std/containers/associative/set/set.cons/compare_copy_constructible.fail.cpp
new file mode 100644
index 00000000000..dcf23effc44
--- /dev/null
+++ b/libcxx/test/std/containers/associative/set/set.cons/compare_copy_constructible.fail.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// 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>
+
+// Check that std::set fails to instantiate if the comparison predicate is
+// not copy-constructible. This is LWG issue 2436
+
+#include <set>
+
+template <class T>
+struct Comp {
+ bool operator () (const T& lhs, const T& rhs) const { return lhs < rhs; }
+
+ Comp () {}
+private:
+ Comp (const Comp &); // declared but not defined
+ };
+
+
+int main() {
+ std::set<int, Comp<int> > m;
+}
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/compare_copy_constructible.fail.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/compare_copy_constructible.fail.cpp
new file mode 100644
index 00000000000..270475702af
--- /dev/null
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/compare_copy_constructible.fail.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// 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>
+
+// Check that std::unordered_map fails to instantiate if the comparison predicate is
+// not copy-constructible. This is LWG issue 2436
+
+#include <unordered_map>
+
+template <class T>
+struct Comp {
+ bool operator () (const T& lhs, const T& rhs) const { return lhs == rhs; }
+
+ Comp () {}
+private:
+ Comp (const Comp &); // declared but not defined
+ };
+
+
+int main() {
+ std::unordered_map<int, int, std::hash<int>, Comp<int> > m;
+}
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/hash_copy_constructible.fail.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/hash_copy_constructible.fail.cpp
new file mode 100644
index 00000000000..8faebcbf1c9
--- /dev/null
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/hash_copy_constructible.fail.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// 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>
+
+// Check that std::unordered_map fails to instantiate if the hash function is
+// not copy-constructible. This is mentioned in LWG issue 2436
+
+#include <unordered_map>
+
+template <class T>
+struct Hash {
+ std::size_t operator () (const T& lhs) const { return 0; }
+
+ Hash () {}
+private:
+ Hash (const Hash &); // declared but not defined
+ };
+
+
+int main() {
+ std::unordered_map<int, int, Hash<int> > m;
+}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/compare_copy_constructible.fail.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/compare_copy_constructible.fail.cpp
new file mode 100644
index 00000000000..ead4fe00ce4
--- /dev/null
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/compare_copy_constructible.fail.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// 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>
+
+// Check that std::unordered_multimap fails to instantiate if the comparison predicate is
+// not copy-constructible. This is LWG issue 2436
+
+#include <unordered_map>
+
+template <class T>
+struct Comp {
+ bool operator () (const T& lhs, const T& rhs) const { return lhs == rhs; }
+
+ Comp () {}
+private:
+ Comp (const Comp &); // declared but not defined
+ };
+
+
+int main() {
+ std::unordered_multimap<int, int, std::hash<int>, Comp<int> > m;
+}
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/hash_copy_constructible.fail.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/hash_copy_constructible.fail.cpp
new file mode 100644
index 00000000000..060f96b1fdc
--- /dev/null
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/hash_copy_constructible.fail.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// 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>
+
+// Check that std::unordered_multimap fails to instantiate if the hash function is
+// not copy-constructible. This is mentioned in LWG issue 2436
+
+#include <unordered_map>
+
+template <class T>
+struct Hash {
+ std::size_t operator () (const T& lhs) const { return 0; }
+
+ Hash () {}
+private:
+ Hash (const Hash &); // declared but not defined
+ };
+
+
+int main() {
+ std::unordered_multimap<int, int, Hash<int> > m;
+}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/compare_copy_constructible.fail.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/compare_copy_constructible.fail.cpp
new file mode 100644
index 00000000000..b38316c3768
--- /dev/null
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/compare_copy_constructible.fail.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// 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>
+
+// Check that std::unordered_set fails to instantiate if the comparison predicate is
+// not copy-constructible. This is LWG issue 2436
+
+#include <unordered_set>
+
+template <class T>
+struct Comp {
+ bool operator () (const T& lhs, const T& rhs) const { return lhs == rhs; }
+
+ Comp () {}
+private:
+ Comp (const Comp &); // declared but not defined
+ };
+
+
+int main() {
+ std::unordered_multiset<int, std::hash<int>, Comp<int> > m;
+}
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/hash_copy_constructible.fail.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/hash_copy_constructible.fail.cpp
new file mode 100644
index 00000000000..a43f94ca2af
--- /dev/null
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/hash_copy_constructible.fail.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// 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>
+
+// Check that std::unordered_multiset fails to instantiate if the hash function is
+// not copy-constructible. This is mentioned in LWG issue 2436
+
+#include <unordered_set>
+
+template <class T>
+struct Hash {
+ std::size_t operator () (const T& lhs) const { return 0; }
+
+ Hash () {}
+private:
+ Hash (const Hash &); // declared but not defined
+ };
+
+
+int main() {
+ std::unordered_multiset<int, Hash<int> > m;
+}
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/compare_copy_constructible.fail.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/compare_copy_constructible.fail.cpp
new file mode 100644
index 00000000000..6b675f00f16
--- /dev/null
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/compare_copy_constructible.fail.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// 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>
+
+// Check that std::unordered_set fails to instantiate if the comparison predicate is
+// not copy-constructible. This is LWG issue 2436
+
+#include <unordered_set>
+
+template <class T>
+struct Comp {
+ bool operator () (const T& lhs, const T& rhs) const { return lhs == rhs; }
+
+ Comp () {}
+private:
+ Comp (const Comp &); // declared but not defined
+ };
+
+
+int main() {
+ std::unordered_set<int, std::hash<int>, Comp<int> > m;
+}
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/hash_copy_constructible.fail.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/hash_copy_constructible.fail.cpp
new file mode 100644
index 00000000000..066f160a258
--- /dev/null
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/hash_copy_constructible.fail.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// 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>
+
+// Check that std::unordered_set fails to instantiate if the hash function is
+// not copy-constructible. This is mentioned in LWG issue 2436
+
+#include <unordered_set>
+
+template <class T>
+struct Hash {
+ std::size_t operator () (const T& lhs) const { return 0; }
+
+ Hash () {}
+private:
+ Hash (const Hash &); // declared but not defined
+ };
+
+
+int main() {
+ std::unordered_set<int, Hash<int> > m;
+}
diff --git a/libcxx/www/cxx1z_status.html b/libcxx/www/cxx1z_status.html
index 10ed7ac3110..5918a2136fc 100644
--- a/libcxx/www/cxx1z_status.html
+++ b/libcxx/www/cxx1z_status.html
@@ -268,7 +268,7 @@
<tr><td><a href="http://wg21.link/LWG2393">2393</a></td><td>std::function's Callable definition is broken</td><td>Oulu</td><td></td></tr>
<tr><td><a href="http://wg21.link/LWG2422">2422</a></td><td>std::numeric_limits&lt;T&gt;::is_modulo description: "most machines" errata</td><td>Oulu</td><td></td></tr>
<tr><td><a href="http://wg21.link/LWG2426">2426</a></td><td>Issue about compare_exchange</td><td>Oulu</td><td></td></tr>
- <tr><td><a href="http://wg21.link/LWG2436">2436</a></td><td>Comparators for associative containers should always be CopyConstructible</td><td>Oulu</td><td></td></tr>
+ <tr><td><a href="http://wg21.link/LWG2436">2436</a></td><td>Comparators for associative containers should always be CopyConstructible</td><td>Oulu</td><td>Complete</td></tr>
<tr><td><a href="http://wg21.link/LWG2441">2441</a></td><td>Exact-width atomic typedefs should be provided</td><td>Oulu</td><td></td></tr>
<tr><td><a href="http://wg21.link/LWG2451">2451</a></td><td>[fund.ts.v2] optional should 'forward' T's implicit conversions</td><td>Oulu</td><td></td></tr>
<tr><td><a href="http://wg21.link/LWG2509">2509</a></td><td>[fund.ts.v2] any_cast doesn't work with rvalue reference targets and cannot move with a value target</td><td>Oulu</td><td></td></tr>
OpenPOWER on IntegriCloud