diff --git a/auto_ptr.hxx.in b/auto_ptr.hxx.in
index c486ae2f293a9433450583ecc702d14c92fbe80a..37ad299aec9eda458706ffbfdb825556a78e8fb3 100644
--- a/auto_ptr.hxx.in
+++ b/auto_ptr.hxx.in
@@ -55,7 +55,7 @@ public:
   auto_ptr(auto_ptr_ref<X> r) throw(): x_(r.p_.release()) {}
   template <class Y> operator auto_ptr_ref<Y>() throw() { return auto_ptr_ref<Y>(*this); }
   template <class Y> operator auto_ptr<Y>() throw() { return release(); }
-  auto_ptr& operator=(auto_ptr_ref<X> r) throw() { x_ = r.p_.release(); return *this; }
+  auto_ptr& operator=(auto_ptr_ref<X> r) throw() { reset(r.p_.release()); return *this; }
 };
 
 } // namespace @KWSYS_NAMESPACE@