c++/9982: placement new returns wrong value
kunert@physik.tu-dresden.de
kunert@physik.tu-dresden.de
Thu Mar 6 18:46:00 GMT 2003
>Number: 9982
>Category: c++
>Synopsis: placement new returns wrong value
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Thu Mar 06 18:46:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: kunert@physik.tu-dresden.de
>Release: 3.4 20030304
>Organization:
>Environment:
Reading specs from /opt/lib/gcc-lib/i686-pc-linux-gnu/3.4/specs
Configured with: ../configure --enable-shared --program-suffix= --prefix=/opt --enable-languages=c,c++,f77 --enable-__cxa_atexit
Thread model: posix
gcc version 3.4 20030304 (experimental)
>Description:
#include<iostream>
using namespace std;
struct A {
~A(){}
};
int main()
{
A * a = (A*) new char[20];
A * b = new(a) A[3];
cout << a << ' ' << b << endl;
}
a and b should be identical, but
running this program shows different velues.
3.2.1 has the same bug.
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-prs
mailing list