Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <3FFCD90C.6000905@terra.com.br> Date: Thu, 08 Jan 2004 01:14:04 -0300 From: =?ISO-8859-1?Q?Marcelo_Rezende_M=F3dolo?= User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5) Gecko/20031007 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: auto_ptr gcc version 3.3.1 (cygming special) problem Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Hi, I am not shure that this is a error , but it is very strange... //autoPtr.cpp #include #include using namespace std; class B { public: B(int cid) : cid_(cid) { cout << "B(" << cid_ << ")\n"; } ~B() { cout << "~B(" << cid_ << ")\n"; } private: int cid_; }; class A { public: A(int cid) : cid_(cid) { cout << "A(" << cid_ << ")\n"; } ~A() { cout << "~A(" << cid_ << ")\n"; } B* getB() { return new B(cid_); } private: int cid_; }; int main(int argc, char *argv[]) { A a(1); auto_ptr b = static_cast< auto_ptr >(a.getB()); A a2(2); auto_ptr b2 = static_cast< auto_ptr >(a2.getB()); cin.get(); return 0; } If I compile this file with gcc version 3.2.3 (mingw special 20030504-1) no errors ocur (g++ -o autoPtr autoPtr.cpp). But if I try to compile using gcc version 3.3.1 (cygming special), with the same command line (g++ -o autoPtr autoPtr.cpp), this errors ocur: autoPtr.cpp: In function `int main(int, char**)': autoPtr.cpp:26: error: invalid static_cast from type `B*' to type ` std::auto_ptr' autoPtr.cpp:29: error: invalid static_cast from type `B*' to type ` std::auto_ptr' what is the problem?? thanks, marcelo -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/