------- Comment #11 from redi at gcc dot gnu dot org 2010-03-01 22:30 ------- (In reply to comment #10) > I think it should still check for resetting to the same value to avoid > duplicate deletes later.
I disagree, double delete can only happen in the case of a programming error. Look at my second example in comment #5 - it may not be a very good idea to write code like that, but it is technically correct (the stored pointer is deleted when reset() is called, then released so it won't be deleted again) and should not leak the stored pointer. If you check for the same value then you will not call the deleter during reset and will leak. I am testing a fix now, but I will not include your suggestion to check p!=old, the C++0x draft requires a certain behaviour and I will implement that. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43183