aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/call.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2014-04-11 13:08:47 -0400
committerJason Merrill <jason@gcc.gnu.org>2014-04-11 13:08:47 -0400
commit4561285bf4a239e6ae6cb03245baff788cea025a (patch)
tree5115b071ab4504478c1daaf4aec1feef5577ff08 /gcc/cp/call.c
parent6602e7fcd7995c29f946b42e07033f86c9ec2fd4 (diff)
downloadgcc-4561285bf4a239e6ae6cb03245baff788cea025a.zip
gcc-4561285bf4a239e6ae6cb03245baff788cea025a.tar.gz
gcc-4561285bf4a239e6ae6cb03245baff788cea025a.tar.bz2
DR 1030 PR c++/51253
DR 1030 PR c++/51253 * cp-tree.h (CALL_EXPR_LIST_INIT_P): New. * call.c (struct z_candidate): Add flags field. (add_candidate): Add flags parm. (add_function_candidate, add_conv_candidate, build_builtin_candidate) (add_template_candidate_real): Pass it. (build_over_call): Set CALL_EXPR_LIST_INIT_P. * tree.c (build_aggr_init_expr): Copy it. * semantics.c (simplify_aggr_init_expr): Preevaluate args if it's set. From-SVN: r209309
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r--gcc/cp/call.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index ae0d4ff..7c0dcc2 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -206,7 +206,7 @@ static conversion *maybe_handle_ref_bind (conversion **);
static void maybe_handle_implicit_object (conversion **);
static struct z_candidate *add_candidate
(struct z_candidate **, tree, tree, const vec<tree, va_gc> *, size_t,
- conversion **, tree, tree, int, struct rejection_reason *);
+ conversion **, tree, tree, int, struct rejection_reason *, int);
static tree source_type (conversion *);
static void add_warning (struct z_candidate *, struct z_candidate *);
static bool reference_compatible_p (tree, tree);
@@ -520,7 +520,6 @@ struct z_candidate {
sequence from the type returned by FN to the desired destination
type. */
conversion *second_conv;
- int viable;
struct rejection_reason *reason;
/* If FN is a member function, the binfo indicating the path used to
qualify the name of FN at the call site. This path is used to
@@ -538,6 +537,10 @@ struct z_candidate {
tree explicit_targs;
candidate_warning *warnings;
z_candidate *next;
+ int viable;
+
+ /* The flags active in add_candidate. */
+ int flags;
};
/* Returns true iff T is a null pointer constant in the sense of
@@ -1810,7 +1813,8 @@ add_candidate (struct z_candidate **candidates,
tree fn, tree first_arg, const vec<tree, va_gc> *args,
size_t num_convs, conversion **convs,
tree access_path, tree conversion_path,
- int viable, struct rejection_reason *reason)
+ int viable, struct rejection_reason *reason,
+ int flags)
{
struct z_candidate *cand = (struct z_candidate *)
conversion_obstack_alloc (sizeof (struct z_candidate));
@@ -1825,6 +1829,7 @@ add_candidate (struct z_candidate **candidates,
cand->viable = viable;
cand->reason = reason;
cand->next = *candidates;
+ cand->flags = flags;
*candidates = cand;
return cand;
@@ -2061,7 +2066,7 @@ add_function_candidate (struct z_candidate **candidates,
out:
return add_candidate (candidates, fn, orig_first_arg, args, len, convs,
- access_path, conversion_path, viable, reason);
+ access_path, conversion_path, viable, reason, flags);
}
/* Create an overload candidate for the conversion function FN which will
@@ -2163,7 +2168,7 @@ add_conv_candidate (struct z_candidate **candidates, tree fn, tree obj,
}
return add_candidate (candidates, totype, first_arg, arglist, len, convs,
- access_path, conversion_path, viable, reason);
+ access_path, conversion_path, viable, reason, flags);
}
static void
@@ -2238,7 +2243,7 @@ build_builtin_candidate (struct z_candidate **candidates, tree fnname,
num_convs, convs,
/*access_path=*/NULL_TREE,
/*conversion_path=*/NULL_TREE,
- viable, reason);
+ viable, reason, flags);
}
static bool
@@ -3056,7 +3061,7 @@ add_template_candidate_real (struct z_candidate **candidates, tree tmpl,
return cand;
fail:
return add_candidate (candidates, tmpl, first_arg, arglist, nargs, NULL,
- access_path, conversion_path, 0, reason);
+ access_path, conversion_path, 0, reason, flags);
}
@@ -7219,7 +7224,11 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
return error_mark_node;
}
- return build_cxx_call (fn, nargs, argarray, complain|decltype_flag);
+ tree call = build_cxx_call (fn, nargs, argarray, complain|decltype_flag);
+ if (TREE_CODE (call) == CALL_EXPR
+ && (cand->flags & LOOKUP_LIST_INIT_CTOR))
+ CALL_EXPR_LIST_INIT_P (call) = true;
+ return call;
}
/* Build and return a call to FN, using NARGS arguments in ARGARRAY.