aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/call.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-12-01 21:57:40 -0500
committerJason Merrill <jason@gcc.gnu.org>2011-12-01 21:57:40 -0500
commitb1c83c23806e200f28a5467e682344bf828dfc9e (patch)
tree533f69a58016333ea6144ae9d283af25fffe6db0 /gcc/cp/call.c
parent7371639a96499bb08992db65cefea1712c47c39f (diff)
downloadgcc-b1c83c23806e200f28a5467e682344bf828dfc9e.zip
gcc-b1c83c23806e200f28a5467e682344bf828dfc9e.tar.gz
gcc-b1c83c23806e200f28a5467e682344bf828dfc9e.tar.bz2
call.c (build_new_method_call_1): Handle aggregate initialization.
* call.c (build_new_method_call_1): Handle aggregate initialization. * tree.c (stabilize_init): Handle CONSTRUCTOR. From-SVN: r181902
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r--gcc/cp/call.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index e7bbf0a..548a36b 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -7198,6 +7198,7 @@ build_new_method_call_1 (tree instance, tree fns, VEC(tree,gc) **args,
&& CONSTRUCTOR_IS_DIRECT_INIT (VEC_index (tree, *args, 0)))
{
tree init_list = VEC_index (tree, *args, 0);
+ tree init = NULL_TREE;
gcc_assert (VEC_length (tree, *args) == 1
&& !(flags & LOOKUP_ONLYCONVERTING));
@@ -7209,8 +7210,16 @@ build_new_method_call_1 (tree instance, tree fns, VEC(tree,gc) **args,
if (CONSTRUCTOR_NELTS (init_list) == 0
&& TYPE_HAS_DEFAULT_CONSTRUCTOR (basetype)
&& !processing_template_decl)
+ init = build_value_init (basetype, complain);
+
+ /* If BASETYPE is an aggregate, we need to do aggregate
+ initialization. */
+ else if (CP_AGGREGATE_TYPE_P (basetype))
+ init = digest_init (basetype, init_list, complain);
+
+ if (init)
{
- tree ob, init = build_value_init (basetype, complain);
+ tree ob;
if (integer_zerop (instance_ptr))
return get_target_expr_sfinae (init, complain);
ob = build_fold_indirect_ref (instance_ptr);
@@ -7219,6 +7228,7 @@ build_new_method_call_1 (tree instance, tree fns, VEC(tree,gc) **args,
return init;
}
+ /* Otherwise go ahead with overload resolution. */
add_list_candidates (fns, first_mem_arg, init_list,
basetype, explicit_targs, template_only,
conversion_path, access_binfo, flags, &candidates);