This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: auto_ptr problems


I have run across a similar issue a few times, and
have even submitted a GNATs report (PR 3946) almost a
year ago.

File: std/std_memory.h
124c124
<    auto_ptr_ref(_Tp1* __p) : _M_ptr(__p) {}
---
>   explicit auto_ptr_ref(_Tp1* __p) : _M_ptr(__p) {}
The need for the auto_ptr_ref constructor to be
'explicit' is demonstrated by Jack's first example,
and my example in the PR, and the technical citation
is in the PR.

The second part of the patch is an obvious typo as
shown with diff -u:
   template <class _Tp1> operator auto_ptr_ref<_Tp1>()
throw() 
-    { return auto_ptr_ref<_Tp>(this->release()); }
+    { return auto_ptr_ref<_Tp1>(this->release()); }

There is no conversion between auto_ptr_ref<Tp> and
auto_ptr_ref<Tp1> for the case where Tp != Tp1, indeed
the template arg Tp1 is unused in the original
function body.

Is there any hope that these two simple and mostly
obvious fixes into 3.1.1?

-Kenny

BTW will we ever get the online compiler back?  That
thing was awesome!

__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]