summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0290-PR-c-48873.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0290-PR-c-48873.patch')
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0290-PR-c-48873.patch45
1 files changed, 45 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0290-PR-c-48873.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0290-PR-c-48873.patch
new file mode 100644
index 0000000000..05fdccb88d
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0290-PR-c-48873.patch
@@ -0,0 +1,45 @@
1From ca1dcc7740a2532bae1d898dd326b43da54a2c54 Mon Sep 17 00:00:00 2001
2From: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
3Date: Fri, 20 May 2011 19:01:53 +0000
4Subject: [PATCH] PR c++/48873
5 * tree.c (stabilize_expr): Don't make gratuitous copies of classes.
6
7git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@173970 138bc75d-0d04-0410-961f-82ee72b054a4
8
9index f04fd23..16b9ca1 100644
10--- a/gcc/cp/tree.c
11+++ b/gcc/cp/tree.c
12@@ -3124,7 +3124,8 @@ stabilize_expr (tree exp, tree* initp)
13
14 if (!TREE_SIDE_EFFECTS (exp))
15 init_expr = NULL_TREE;
16- else if (!TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (exp))
17+ else if ((!TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (exp))
18+ && !TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (exp)))
19 || !lvalue_or_rvalue_with_address_p (exp))
20 {
21 init_expr = get_target_expr (exp);
22new file mode 100644
23index 0000000..f827857
24--- /dev/null
25+++ b/gcc/testsuite/g++.dg/init/new32.C
26@@ -0,0 +1,16 @@
27+// PR c++/48873
28+
29+#include <new>
30+
31+struct D {
32+private:
33+ ~D();
34+};
35+
36+template<class T>
37+T& create();
38+
39+void f()
40+{
41+ D* dp = new (((void*) 0)) D(create<D>()); // #
42+}
43--
441.7.0.4
45