aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@yorick.cygnus.com>1998-05-08 00:51:27 +0000
committerJason Merrill <jason@gcc.gnu.org>1998-05-07 20:51:27 -0400
commit749adefd03907c4dd0e039ad8cb6c4345a3b5bf7 (patch)
tree0015f6f7bffdad2f89fcd1afe8203b41c9644f67
parentbbeb7b6556c304085c8e2b4b1a600e0805e76936 (diff)
downloadgcc-749adefd03907c4dd0e039ad8cb6c4345a3b5bf7.zip
gcc-749adefd03907c4dd0e039ad8cb6c4345a3b5bf7.tar.gz
gcc-749adefd03907c4dd0e039ad8cb6c4345a3b5bf7.tar.bz2
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
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/call.c23
2 files changed, 19 insertions, 9 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index c5699e6..8c4b6ba 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+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>
* method.c (build_decl_overload_real): Set TREE_USED flag to
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index c7eaed4..c79fafc 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -2087,19 +2087,16 @@ build_user_type_conversion_1 (totype, expr, flags)
ics = implicit_conversion
(totype, TREE_TYPE (TREE_TYPE (fn)), 0, convflags);
else
- /* Here, the template conversion operator result must
- precisely match the TOTYPE. (FIXME: Actually, we're
- 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);
+ /* We can't compute this yet. */
+ ics = error_mark_node;
if (TREE_CODE (totype) == REFERENCE_TYPE && ics && ICS_BAD_FLAG (ics))
/* ignore the near match. */;
else if (ics)
for (; fn; fn = DECL_CHAIN (fn))
{
+ struct z_candidate *old_candidates = candidates;
+
if (TREE_CODE (fn) == TEMPLATE_DECL)
{
templates = scratch_tree_cons (NULL_TREE, fn, templates);
@@ -2111,11 +2108,19 @@ build_user_type_conversion_1 (totype, expr, flags)
candidates = add_function_candidate (candidates, fn,
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->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;
}
}