Sytem information:
- LFS-based Linux, with kernel 2.6.15 (with some genpatches)
GCC configuring
---------------
./gcc-3.4.3/configure --prefix=/usr \
--libexecdir=/usr/lib --enable-shared \
--enable-threads=posix --enable-__cxa_atexit \
--enable-clocale=gnu --enable-languages=c,c++
GCC Compiling:
-------------
make
bug description:
-----------------
We compiled the attached source code using the command:
> g++ --save-temps build_and_destroy.cc -o bug
Running ./bug produced the following output:
A
A copy
A
~A
A.m:1
~A
~A
As you can see, returning the object in the function F didn't call the copy
constructor. We expect the following output:
A
A copy
A
A copy
~A
~A
A.m:2
~A
~A
--
Summary: Returning object ignores copy constructor
Product: gcc
Version: 3.4.3
Status: UNCONFIRMED
Severity: critical
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ist_alex at yahoo dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28761