diff --git a/include/__hash_table b/include/__hash_table index 13ab928e1..86cd9315d 100644 --- a/include/__hash_table +++ b/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::value), + "Predicate must be copy-constructible."); + static_assert((is_copy_constructible::value), + "Hasher must be copy-constructible."); private: diff --git a/include/__tree b/include/__tree index 89707e38f..e4863a02a 100644 --- a/include/__tree +++ b/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), + "Comparator must be copy-constructible."); private: __node_pointer __begin_node_; diff --git a/test/std/containers/associative/map/map.cons/compare_copy_constructible.fail.cpp b/test/std/containers/associative/map/map.cons/compare_copy_constructible.fail.cpp new file mode 100644 index 000000000..81ccba3bb --- /dev/null +++ b/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. +// +//===----------------------------------------------------------------------===// + +// + +// Check that std::map fails to instantiate if the comparison predicate is +// not copy-constructible. This is LWG issue 2436 + +#include + +template +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 > m; +} diff --git a/test/std/containers/associative/multimap/multimap.cons/compare_copy_constructible.fail.cpp b/test/std/containers/associative/multimap/multimap.cons/compare_copy_constructible.fail.cpp new file mode 100644 index 000000000..e6f6c3efe --- /dev/null +++ b/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. +// +//===----------------------------------------------------------------------===// + +// + +// Check that std::multimap fails to instantiate if the comparison predicate is +// not copy-constructible. This is LWG issue 2436 + +#include + +template +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 > m; +} diff --git a/test/std/containers/associative/multiset/multiset.cons/compare_copy_constructible.fail.cpp b/test/std/containers/associative/multiset/multiset.cons/compare_copy_constructible.fail.cpp new file mode 100644 index 000000000..2eade5299 --- /dev/null +++ b/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. +// +//===----------------------------------------------------------------------===// + +// + +// Check that std::multiset fails to instantiate if the comparison predicate is +// not copy-constructible. This is LWG issue 2436 + +#include + +template +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 > m; +} diff --git a/test/std/containers/associative/set/set.cons/compare_copy_constructible.fail.cpp b/test/std/containers/associative/set/set.cons/compare_copy_constructible.fail.cpp new file mode 100644 index 000000000..dcf23effc --- /dev/null +++ b/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. +// +//===----------------------------------------------------------------------===// + +// + +// Check that std::set fails to instantiate if the comparison predicate is +// not copy-constructible. This is LWG issue 2436 + +#include + +template +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 > m; +} diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/compare_copy_constructible.fail.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/compare_copy_constructible.fail.cpp new file mode 100644 index 000000000..270475702 --- /dev/null +++ b/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. +// +//===----------------------------------------------------------------------===// + +// + +// Check that std::unordered_map fails to instantiate if the comparison predicate is +// not copy-constructible. This is LWG issue 2436 + +#include + +template +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, Comp > m; +} diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/hash_copy_constructible.fail.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/hash_copy_constructible.fail.cpp new file mode 100644 index 000000000..8faebcbf1 --- /dev/null +++ b/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. +// +//===----------------------------------------------------------------------===// + +// + +// Check that std::unordered_map fails to instantiate if the hash function is +// not copy-constructible. This is mentioned in LWG issue 2436 + +#include + +template +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 > m; +} diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/compare_copy_constructible.fail.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/compare_copy_constructible.fail.cpp new file mode 100644 index 000000000..ead4fe00c --- /dev/null +++ b/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. +// +//===----------------------------------------------------------------------===// + +// + +// Check that std::unordered_multimap fails to instantiate if the comparison predicate is +// not copy-constructible. This is LWG issue 2436 + +#include + +template +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, Comp > m; +} diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/hash_copy_constructible.fail.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/hash_copy_constructible.fail.cpp new file mode 100644 index 000000000..060f96b1f --- /dev/null +++ b/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. +// +//===----------------------------------------------------------------------===// + +// + +// Check that std::unordered_multimap fails to instantiate if the hash function is +// not copy-constructible. This is mentioned in LWG issue 2436 + +#include + +template +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 > m; +} diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/compare_copy_constructible.fail.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/compare_copy_constructible.fail.cpp new file mode 100644 index 000000000..b38316c37 --- /dev/null +++ b/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. +// +//===----------------------------------------------------------------------===// + +// + +// Check that std::unordered_set fails to instantiate if the comparison predicate is +// not copy-constructible. This is LWG issue 2436 + +#include + +template +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, Comp > m; +} diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/hash_copy_constructible.fail.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/hash_copy_constructible.fail.cpp new file mode 100644 index 000000000..a43f94ca2 --- /dev/null +++ b/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. +// +//===----------------------------------------------------------------------===// + +// + +// Check that std::unordered_multiset fails to instantiate if the hash function is +// not copy-constructible. This is mentioned in LWG issue 2436 + +#include + +template +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 > m; +} diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/compare_copy_constructible.fail.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/compare_copy_constructible.fail.cpp new file mode 100644 index 000000000..6b675f00f --- /dev/null +++ b/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. +// +//===----------------------------------------------------------------------===// + +// + +// Check that std::unordered_set fails to instantiate if the comparison predicate is +// not copy-constructible. This is LWG issue 2436 + +#include + +template +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, Comp > m; +} diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/hash_copy_constructible.fail.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/hash_copy_constructible.fail.cpp new file mode 100644 index 000000000..066f160a2 --- /dev/null +++ b/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. +// +//===----------------------------------------------------------------------===// + +// + +// Check that std::unordered_set fails to instantiate if the hash function is +// not copy-constructible. This is mentioned in LWG issue 2436 + +#include + +template +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 > m; +} diff --git a/www/cxx1z_status.html b/www/cxx1z_status.html index 10ed7ac31..5918a2136 100644 --- a/www/cxx1z_status.html +++ b/www/cxx1z_status.html @@ -268,7 +268,7 @@ 2393std::function's Callable definition is brokenOulu 2422std::numeric_limits<T>::is_modulo description: "most machines" errataOulu 2426Issue about compare_exchangeOulu - 2436Comparators for associative containers should always be CopyConstructibleOulu + 2436Comparators for associative containers should always be CopyConstructibleOuluComplete 2441Exact-width atomic typedefs should be providedOulu 2451[fund.ts.v2] optional should 'forward' T's implicit conversionsOulu 2509[fund.ts.v2] any_cast doesn't work with rvalue reference targets and cannot move with a value targetOulu