re PR c++/48873 ([C++0x][noexcept] Placement-new problem with deleted destructors)

PR c++/48873
	* tree.c (stabilize_expr): Don't make gratuitous copies of classes.

From-SVN: r173978
This commit is contained in:
Jason Merrill 2011-05-20 16:01:19 -04:00 committed by Jason Merrill
parent 7abe7b2a55
commit d841f02bac
4 changed files with 27 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2011-05-20 Jason Merrill <jason@redhat.com>
PR c++/48873
* tree.c (stabilize_expr): Don't make gratuitous copies of classes.
2011-05-09 Jason Merrill <jason@redhat.com>
PR c++/48936

View File

@ -2663,7 +2663,8 @@ stabilize_expr (tree exp, tree* initp)
if (!TREE_SIDE_EFFECTS (exp))
init_expr = NULL_TREE;
else if (!real_lvalue_p (exp)
|| !TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (exp)))
|| (!TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (exp))
&& !TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (exp))))
{
init_expr = get_target_expr (exp);
exp = TARGET_EXPR_SLOT (init_expr);

View File

@ -1,3 +1,7 @@
2011-05-20 Jason Merrill <jason@redhat.com>
* g++.dg/init/new32.C: New.
2011-05-14 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
Backport from mainline:

View File

@ -0,0 +1,16 @@
// PR c++/48873
#include <new>
struct D {
private:
~D();
};
template<class T>
T& create();
void f()
{
D* dp = new (((void*) 0)) D(create<D>()); // #
}