aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/init.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-06-29 10:08:55 -0400
committerJason Merrill <jason@gcc.gnu.org>2011-06-29 10:08:55 -0400
commit2061820e0d4998d1792021cfa7283c2ce345b093 (patch)
treed366c391a4221521f9154a0ece1a5d527bf85bfd /gcc/cp/init.c
parent902233e09cf56332a7823aaf4e28807d73229599 (diff)
downloadgcc-2061820e0d4998d1792021cfa7283c2ce345b093.zip
gcc-2061820e0d4998d1792021cfa7283c2ce345b093.tar.gz
gcc-2061820e0d4998d1792021cfa7283c2ce345b093.tar.bz2
DR 990
DR 990 * call.c (convert_like_real) [ck_user]: Handle value-initialization. (build_new_method_call_1): Likewise. * init.c (expand_default_init): Handle direct list-initialization of aggregates. From-SVN: r175639
Diffstat (limited to 'gcc/cp/init.c')
-rw-r--r--gcc/cp/init.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 3ceed90..1719339 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -1443,6 +1443,17 @@ expand_default_init (tree binfo, tree true_exp, tree exp, tree init, int flags,
tree rval;
VEC(tree,gc) *parms;
+ /* If we have direct-initialization from an initializer list, pull
+ it out of the TREE_LIST so the code below can see it. */
+ if (init && TREE_CODE (init) == TREE_LIST
+ && BRACE_ENCLOSED_INITIALIZER_P (TREE_VALUE (init))
+ && CONSTRUCTOR_IS_DIRECT_INIT (TREE_VALUE (init)))
+ {
+ gcc_checking_assert ((flags & LOOKUP_ONLYCONVERTING) == 0
+ && TREE_CHAIN (init) == NULL_TREE);
+ init = TREE_VALUE (init);
+ }
+
if (init && BRACE_ENCLOSED_INITIALIZER_P (init)
&& CP_AGGREGATE_TYPE_P (type))
{