From 6681641e6f9638bf4a8b80be12858ab438be0152 Mon Sep 17 00:00:00 2001 From: jason 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 struct B { + T ar[1]; + B(T t):ar({t}) {} +}; + +int main(){ + B bi{1}; + A1 a1; + B ba1{a1}; + A2 a2; + A2 a2r[1]{{a2}}; + B ba2{a2}; +} -- 1.7.0.4