This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/36394] New: DR178: new non_POD() is handled incorrectly
- 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: 30 May 2008 21:03:47 -0000
- Subject: [Bug c++/36394] New: DR178: new non_POD() is handled incorrectly
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#178
This Defect report changes how () is handled. It seems a bit weird but we
don't implement it. We still implement the way as described in the standard
and do a default initializer and not a value initializer.
An example is:
#include <stdio.h>
void *gp;
class Jim
{
public:
int x[ 1000 ];
Jim() {}
};
class Fred : public Jim
{
public:
void *operator new( size_t size, char *my_name ) { Fred *pf = (Fred*)gp;
pf->message = my_name; return (void*)pf; }
char *message;
};
Fred *xxxx() { return new ( "fred" )Fred(); }
Here xxxx should zero both message and x instead of just calling the
constructor. Now I don't know if makes sense any more.
--
Summary: DR178: new non_POD() is handled incorrectly
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pinskia at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36394