https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90388
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2019-05-08 Ever confirmed|0 |1 --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Jonathan Wakely from comment #0) > Also, hash<UP>::operator() should not be unconditionally noexcept, because > (if it is enabled) hash<UP::pointer>::operator() might throw > ([util.smartptr.hash] p1). Here's a testcase for that part, which should exit normally but calls std::terminate(): #include <memory> struct D { struct pointer { }; void operator()(pointer) const noexcept { } }; bool operator==(D::pointer, std::nullptr_t) { return false; } bool operator!=(D::pointer, std::nullptr_t) { return true; } namespace std { template<> struct hash<D::pointer> { size_t operator()(D::pointer) const { throw 1; } }; } int main() { using UP = std::unique_ptr<int, D>; UP p; std::hash<UP> h; try { h(p); } catch (int) { } }