[Bug tree-optimization/16115] [3.5 regression] problem with argument passing via temporary (breaks auto_ptr)

bangerth at dealii dot org gcc-bugzilla@gcc.gnu.org
Mon Jun 21 16:55:00 GMT 2004


------- Additional Comments From bangerth at dealii dot org  2004-06-21 16:55 -------
Confirmed. With this minimally modified testcase 
------------------------ 
#include <memory> 
 
struct A 
{ 
    A() { printf ("a ctor %x\n", this); } 
    A(const A&) { printf ("a copy ctor %x\n", this); } 
    ~A() { printf ("a dtor %x\n", this); } 
}; 
 
 
void foo (std::auto_ptr<A> a) 
{ 
  delete a.release(); 
} 
 
 
int main () 
{ 
  foo (std::auto_ptr<A> (new A)); 
} 
----------------------- 
we can also see that the copy constructor is not called, and that thus 
the number of con- and destructor calls do not match -- bad... 
 
g/x> /home/bangerth/bin/gcc-3.5-pre/bin/c++ x.cc -O2 
g/x> ./a.out  
a ctor 804a008 
a dtor 804a008 
a dtor 804a008 
 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |wrong-code
   Last reconfirmed|0000-00-00 00:00:00         |2004-06-21 16:55:31
               date|                            |
            Summary|3.5: problem with argument  |[3.5 regression] problem
                   |passing via temporary       |with argument passing via
                   |(breaks auto_ptr)           |temporary (breaks auto_ptr)
   Target Milestone|---                         |3.5.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16115



More information about the Gcc-bugs mailing list