This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/34121] wrong this pointer passed to constructor of temporary object
- From: "gcc-bugzilla at contacts dot eelis dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 Aug 2008 12:51:28 -0000
- Subject: [Bug c++/34121] wrong this pointer passed to constructor of temporary object
- References: <bug-34121-15371@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #4 from gcc-bugzilla at contacts dot eelis dot net 2008-08-21 12:51 -------
Isolated and reproduced with GCC 4.4 on x86_64:
#include <iostream>
#include <stdint.h>
struct A
{
uint64_t p;
char m_ac[18];
A() { std::cout << "default constructed at " << this << '\n'; }
~A() { std::cout << "destructed at " << this << '\n'; }
A(A const &) { std::cout << "copy constructed at " << this << '\n'; }
};
A f() { return A(); }
struct B: A { B(): A(f()) {} };
int main() { B b; }
Output:
default constructed at 0x7fffd583ca40
destructed at 0x7fffd583ca90
These two addresses really should be the same.
--
gcc-bugzilla at contacts dot eelis dot net changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |gcc-bugzilla at contacts dot
| |eelis dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34121