initialization of non-const reference type

Hany Morcos hanymorcos@yahoo.com
Wed Aug 30 10:46:00 GMT 2000


How do I replace 1000 occrance of this problem?

hany

--- Hany Morcos <hanymorcos@yahoo.com> wrote:
> 
> I'm getting the following error message from this
> code. I understand the error message but why would
> gcc
> complain about this... There is a flag to disable
> it..
> 
> 
> thank You
> 
> Hany
> 
> 
> 
> aa.cpp: In function `int main(...)':
> aa.cpp:25: initialization of non-const reference
> type
> `class auto_ptr<TT> &'
> aa.cpp:25: from rvalue of type `auto_ptr<TT>'
>
/home/gcc-2.95.2-solaris7/lib/gcc-lib/sparc-sun-solaris2.7/2.95.2/../../../../include/g++-3/memory:40:
> in passing argument 1 of `auto_ptr<TT>::operator
> =(auto_ptr<TT> &)'
> 
>      1	#include <iostream.h>
>      2	#include <string>
>      3	#include <strstream>
>      4	#include <memory>
>      5	
>      6	using std::auto_ptr;
>      7	
>      8	class TT {
>      9	 public:
>     10	   TT () {}
>     11	
>     12	};
>     13	
>     14	class GG {
>     15	   public:
>     16	    GG() {}
>     17	    auto_ptr <TT> y; 
>     18	};
>     19	
>     20	
>     21	void main()
>     22	{
>     23	 class GG tt; 
>     24	
>     25	    tt.y = auto_ptr <TT> (new TT ()); 
>     26	}
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Mail - Free email you can access from
> anywhere!
> http://mail.yahoo.com/


__________________________________________________
Do You Yahoo!?
Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/


More information about the Gcc-help mailing list