FW: std::auto_ptr

Kick Damien-DKICK1 DKICK1@motorola.com
Thu Jun 5 15:11:00 GMT 2003


Forgot to include the GCC list.  

-----Original Message-----
From: Kick Damien-DKICK1 
Sent: Wednesday, 04 June, 2003 20:24
To: 'Benjamin Kosnik'
Subject: RE: std::auto_ptr


Actually, I posted this question to the GCC list because I was under the impression that it was the overload resolution that is at fault here.  I'm not an expert, but my understanding of <http://www.awprofessional.com/content/images/020163371X/autoptrupdate%5Cauto_ptr_update.html#twotothree>, in particular "(4) Copy-initialization, base-from-derived" and the source code for auto_ptr makes me think that when g++ tells me the following:

[kick@csdndev08 ~/tmp]% make -f/dev/null f00f
g++     f00f.cc   -o f00f
f00f.cc: In function `int main()':
f00f.cc:19: no matching function for call to `std::auto_ptr<Base>::auto_ptr(
   std::auto_ptr<Base>)'
/usr/test/awo/user_work/kick/sparc-sun-solaris2.7-32/gcc-3.2.2/include/c++/3.2.2/memory:346: candidates
   are: std::auto_ptr<_Tp>::auto_ptr(std::auto_ptr_ref<_Tp>) [with _Tp = Base]
/usr/test/awo/user_work/kick/sparc-sun-solaris2.7-32/gcc-3.2.2/include/c++/3.2.2/memory:216: 
                  std::auto_ptr<_Tp>::auto_ptr(std::auto_ptr<_Tp1>&) [with _Tp1 
   = Base, _Tp = Base]
/usr/test/awo/user_work/kick/sparc-sun-solaris2.7-32/gcc-3.2.2/include/c++/3.2.2/memory:203: 
                  std::auto_ptr<_Tp>::auto_ptr(std::auto_ptr<_Tp>&) [with _Tp = 
   Base]
f00f.cc:19:   initializing temporary from result of `
   std::auto_ptr<_Tp>::operator std::auto_ptr<_Tp1>() [with _Tp1 = Base, _Tp = 
   Derived]'
make: *** [f00f] Error 1
[kick@csdndev08 ~/tmp]% 

That it should really be picking "std::auto_ptr<_Tp>::auto_ptr(std::auto_ptr_ref<_Tp>) [with _Tp = Base]" and not merely considering it to be a candidate.

Does this make sense or do you think I'm mistaken?

-----Original Message-----
From: Benjamin Kosnik [mailto:bkoz@redhat.com] 
Sent: Wednesday, 04 June, 2003 20:01
To: Damien Kick
Cc: gcc@gcc.gnu.org
Subject: Re: std::auto_ptr



> Maybe I just utterly confused

You should post libstdc++ and C++ runtime issues to libstdc++@gcc.gnu.org.
See this for more info:

http://gcc.gnu.org/lists.html

-benjamin



More information about the Gcc mailing list