https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90388

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Patch for both issues:

@@ -830,14 +847,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   template<typename _Tp, typename _Dp>
     struct hash<unique_ptr<_Tp, _Dp>>
     : public __hash_base<size_t, unique_ptr<_Tp, _Dp>>,
-    private __poison_hash<typename unique_ptr<_Tp, _Dp>::pointer>
+      private __poison_hash<typename unique_ptr<_Tp, _Dp>::pointer>
     {
-      size_t
-      operator()(const unique_ptr<_Tp, _Dp>& __u) const noexcept
-      {
-       typedef unique_ptr<_Tp, _Dp> _UP;
-       return std::hash<typename _UP::pointer>()(__u.get());
-      }
+    private:
+      using __poison_base
+       = __poison_hash<typename unique_ptr<_Tp, _Dp>::pointer>;
+      template<typename _Up>
+       using __enabled
+         = __and_<is_same<_Up, unique_ptr<_Tp, _Dp>>,
+                  __bool_constant<__poison_base::__enable_hash_call>>;
+
+    public:
+      template<typename _Up>
+       typename enable_if<__enabled<_Up>::value, size_t>::type
+       operator()(const _Up& __u) const
+       {
+         return std::hash<typename _Up::pointer>()(__u.get());
+       }
     };

 #if __cplusplus > 201103L

Reply via email to