[Bug libstdc++/54351] ~unique_ptr() should not set __p to null
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Aug 22 18:58:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54351
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-08-22 18:58:22 UTC ---
I'll test this change:
@@ -169,7 +169,13 @@
#endif
// Destructor.
- ~unique_ptr() noexcept { reset(); }
+ ~unique_ptr() noexcept
+ {
+ auto& __ptr = std::get<0>(_M_t);
+ if (__ptr != pointer())
+ get_deleter()(__ptr);
+ __ptr = pointer();
+ }
// Assignment.
unique_ptr&
More information about the Gcc-bugs
mailing list