aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0334-PR-c-45418.patch
blob: 74627bf5b809acdd65eb2a2c45f7b30c96e231ac (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
From 6681641e6f9638bf4a8b80be12858ab438be0152 Mon Sep 17 00:00:00 2001
From: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Wed, 25 May 2011 15:26:33 +0000
Subject: [PATCH] 	PR c++/45418
 	* init.c (perform_member_init): Handle list-initialization
 	of array of non-trivial class type.

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

index 286bfb6..172a71a 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -528,6 +528,8 @@ perform_member_init (tree member, tree init)
 	    {
 	      gcc_assert (TREE_CHAIN (init) == NULL_TREE);
 	      init = TREE_VALUE (init);
+	      if (BRACE_ENCLOSED_INITIALIZER_P (init))
+		init = digest_init (type, init);
 	    }
 	  if (init == NULL_TREE
 	      || same_type_ignoring_top_level_qualifiers_p (type,
new file mode 100644
index 0000000..ef4e72c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist50.C
@@ -0,0 +1,21 @@
+// PR c++/45418
+// { dg-options -std=c++0x }
+
+struct A1 { };
+struct A2 {
+  A2();
+};
+
+template <class T> struct B {
+  T ar[1];
+  B(T t):ar({t}) {}
+};
+
+int main(){
+  B<int> bi{1};
+  A1 a1;
+  B<A1> ba1{a1};
+  A2 a2;
+  A2 a2r[1]{{a2}};
+  B<A2> ba2{a2};
+}
-- 
1.7.0.4