Commit 749adefd by Jason Merrill Committed by Jason Merrill

call.c (build_user_type_conversion_1): Handle second_conv properly for templates.

	* call.c (build_user_type_conversion_1): Handle second_conv
	properly for templates.

From-SVN: r19626
parent bbeb7b65
Fri May 8 00:43:50 1998 Jason Merrill <jason@yorick.cygnus.com>
* call.c (build_user_type_conversion_1): Handle second_conv
properly for templates.
Thu May 7 17:09:25 EDT 1998 Andrew MacLeod <amacleod@cygnus.com> Thu May 7 17:09:25 EDT 1998 Andrew MacLeod <amacleod@cygnus.com>
* method.c (build_decl_overload_real): Set TREE_USED flag to * method.c (build_decl_overload_real): Set TREE_USED flag to
......
...@@ -2087,19 +2087,16 @@ build_user_type_conversion_1 (totype, expr, flags) ...@@ -2087,19 +2087,16 @@ build_user_type_conversion_1 (totype, expr, flags)
ics = implicit_conversion ics = implicit_conversion
(totype, TREE_TYPE (TREE_TYPE (fn)), 0, convflags); (totype, TREE_TYPE (TREE_TYPE (fn)), 0, convflags);
else else
/* Here, the template conversion operator result must /* We can't compute this yet. */
precisely match the TOTYPE. (FIXME: Actually, we're ics = error_mark_node;
supposed to do some simple conversions here; see
[temp.deduct.conv].). If the result of the conversion
operator is not actually TOTYPE, then
add_template_candidate will fail below. */
ics = implicit_conversion (totype, totype, 0, convflags);
if (TREE_CODE (totype) == REFERENCE_TYPE && ics && ICS_BAD_FLAG (ics)) if (TREE_CODE (totype) == REFERENCE_TYPE && ics && ICS_BAD_FLAG (ics))
/* ignore the near match. */; /* ignore the near match. */;
else if (ics) else if (ics)
for (; fn; fn = DECL_CHAIN (fn)) for (; fn; fn = DECL_CHAIN (fn))
{ {
struct z_candidate *old_candidates = candidates;
if (TREE_CODE (fn) == TEMPLATE_DECL) if (TREE_CODE (fn) == TEMPLATE_DECL)
{ {
templates = scratch_tree_cons (NULL_TREE, fn, templates); templates = scratch_tree_cons (NULL_TREE, fn, templates);
...@@ -2111,11 +2108,19 @@ build_user_type_conversion_1 (totype, expr, flags) ...@@ -2111,11 +2108,19 @@ build_user_type_conversion_1 (totype, expr, flags)
candidates = add_function_candidate (candidates, fn, candidates = add_function_candidate (candidates, fn,
args, flags); args, flags);
if (candidates) if (candidates != old_candidates)
{ {
if (TREE_CODE (fn) == TEMPLATE_DECL)
ics = implicit_conversion
(totype, TREE_TYPE (TREE_TYPE (candidates->fn)),
0, convflags);
candidates->second_conv = ics; candidates->second_conv = ics;
candidates->basetype_path = TREE_PURPOSE (convs); candidates->basetype_path = TREE_PURPOSE (convs);
if (candidates->viable == 1 && ICS_BAD_FLAG (ics))
if (ics == NULL_TREE)
candidates->viable = 0;
else if (candidates->viable == 1 && ICS_BAD_FLAG (ics))
candidates->viable = -1; candidates->viable = -1;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment