@@ -210,6 +210,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
static_assert(is_same<typename _Alloc::value_type, _Value>{},
"unordered container must have the same value_type as its allocator");
#endif
+ static_assert(is_copy_constructible<_Hash>::value,
+ "hash function must be copy constructible");
using __traits_type = _Traits;
using __hash_cached = typename __traits_type::__hash_cached;
new file mode 100644
@@ -0,0 +1,16 @@
+// { dg-do compile { target c++11 } }
+
+#include <unordered_map>
+
+struct S { };
+
+void
+test_pr115420()
+{
+ std::unordered_map<S, int> m; // { dg-error "here" }
+}
+
+// { dg-error "hash function must be copy constructible" "" { target *-*-* } 0 }
+// { dg-prune-output "use of deleted function" }
+// { dg-prune-output "is private" }
+// { dg-prune-output "no matching function" }