This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH] Fix placement new if operator new has 2nd argument REFERENCE_TYPE (PR c++/34862)
- From: "Richard Guenther" <richard dot guenther at gmail dot com>
- To: "Jason Merrill" <jason at redhat dot com>
- Cc: "Jakub Jelinek" <jakub at redhat dot com>, "Mark Mitchell" <mark at codesourcery dot com>, "Ian Lance Taylor" <iant at google dot com>, gcc-patches at gcc dot gnu dot org
- Date: Tue, 5 Feb 2008 18:34:12 +0100
- Subject: Re: [C++ PATCH] Fix placement new if operator new has 2nd argument REFERENCE_TYPE (PR c++/34862)
- References: <20080129130601.GL30691@devserv.devel.redhat.com> <47A89C0A.9010201@redhat.com>
On Feb 5, 2008 6:25 PM, Jason Merrill <jason@redhat.com> wrote:
> It seems to me that this (and Ian's original patch) are approaching this
> problem the wrong way: we shouldn't be trying to guess whether a pointer
> is changing type based on the form of the call to new; this won't handle
> a user-defined placement new, or a user-defined override of the
> non-placement operator new which always returns the same pointer. Can't
> we attach the CHANGE_DYNAMIC_TYPE_EXPR to the value returned from
> operator new, rather than mess with the arguments?
The problem arises at the point of inlining, where the optimizers need to see
that at the _beginning_ of the inlined new operator the dynamic type
of the storage is changing. So it's not enough to mark its result as
having a distinct type.
Richard.