This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


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

Re: c++/3282: Problems with throw and destuctor callings


> 
> #include <iostream.h>
> int global;
> 
> class One {
> public:
>         int num;
>         One() { num=++global; cout << "One " <<num<<endl; };
>         void Copy(One second_one) { cout << "Copy " <<num<<endl; };
>         ~One() { cout << "~One "<<num<<endl; };
> };
> 

This is not a bug. Define copy constructor for class One, like        

   One( const One& ) { num=++global; cout<<"One copy constructor"<<num<<endl; }

and see if it helps.




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