summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0185-PR-c-48726.patch
blob: 50987f04ea087d05b08e35c175cc8a16775ac4f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
Upstream-Status: Inappropriate [Backport]
From c0df85fc6ea1962c53f98bbca38d182eba8e23f7 Mon Sep 17 00:00:00 2001
From: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Tue, 26 Apr 2011 23:42:50 +0000
Subject: [PATCH 185/200] 	PR c++/48726
 	* call.c (convert_like_real): Correct TREE_CONSTANT on CONSTRUCTOR.
 	* decl.c (reshape_init_array_1): Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@172993 138bc75d-0d04-0410-961f-82ee72b054a4

index c84e6fc..246fb6d 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -5481,6 +5481,8 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
 	    if (!BRACE_ENCLOSED_INITIALIZER_P (val))
 	      check_narrowing (TREE_TYPE (sub), val);
 	    CONSTRUCTOR_APPEND_ELT (CONSTRUCTOR_ELTS (new_ctor), NULL_TREE, sub);
+	    if (!TREE_CONSTANT (sub))
+	      TREE_CONSTANT (new_ctor) = false;
 	  }
 	/* Build up the array.  */
 	elttype = cp_build_qualified_type
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 61b57ea..6f8bb9f 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -4904,6 +4904,8 @@ reshape_init_array_1 (tree elt_type, tree max_index, reshape_iter *d)
 	return error_mark_node;
       CONSTRUCTOR_APPEND_ELT (CONSTRUCTOR_ELTS (new_init),
 			      size_int (index), elt_init);
+      if (!TREE_CONSTANT (elt_init))
+	TREE_CONSTANT (new_init) = false;
     }
 
   return new_init;
new file mode 100644
index 0000000..9eb451a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist48.C
@@ -0,0 +1,11 @@
+// PR c++/48726
+// { dg-options -std=c++0x }
+
+#include <memory>
+
+struct Foo{
+    int i;
+};
+typedef std::unique_ptr<Foo> up;
+
+std::initializer_list<up> il{up{new Foo}, up{new Foo}};
-- 
1.7.0.4

OpenPOWER on IntegriCloud