This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/29286] [4.2 Regression] placement new does not change the dynamic type as it should
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Sep 2006 15:51:21 -0000
- Subject: [Bug libstdc++/29286] [4.2 Regression] placement new does not change the dynamic type as it should
- References: <bug-29286-10053@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #7 from pinskia at gcc dot gnu dot org 2006-09-29 15:51 -------
Note here is a slightly better testcase as now we know that Foo and Bar are the
same size:
#include <new>
struct Foo { void *i; };
struct Bar { void *p; };
long foo(int n, int *t)
{
Foo *f = new Foo;
f->i = t;
for (int i=0; i<n; ++i)
{
Bar *b = new (f) Bar;
b->p = 0;
f = new (f) Foo;
f->i = t;
}
return f->i;
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29286