call.c (print_conversion_rejection): Handle n_arg of -2.
authorJason Merrill <jason@redhat.com>
Tue, 25 Feb 2014 21:27:44 +0000 (16:27 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 25 Feb 2014 21:27:44 +0000 (16:27 -0500)
* call.c (print_conversion_rejection): Handle n_arg of -2.
(build_user_type_conversion_1): Pass it.

From-SVN: r208158

gcc/cp/ChangeLog
gcc/cp/call.c

index c4a81771a5b79596dbbc97c81f3219dcbb0b6f3e..b3534991d41d059fd26d64c927dc6444f18f0eb7 100644 (file)
@@ -1,5 +1,8 @@
 2014-02-25  Jason Merrill  <jason@redhat.com>
 
+       * call.c (print_conversion_rejection): Handle n_arg of -2.
+       (build_user_type_conversion_1): Pass it.
+
        PR c++/55877
        * decl2.c (no_linkage_error): Handle C++98 semantics.
        (reset_type_linkage): Move from decl.c.
index d3db585ecbe0064bd75b8e5b82c87f5088136365..700099d99ddfe6dde3733b8d1e65f433160a7348 100644 (file)
@@ -3180,6 +3180,10 @@ print_conversion_rejection (location_t loc, struct conversion_info *info)
     inform (loc, "  no known conversion for implicit "
            "%<this%> parameter from %qT to %qT",
            info->from_type, info->to_type);
+  else if (info->n_arg == -2)
+    /* Conversion of conversion function return value failed.  */
+    inform (loc, "  no known conversion from %qT to %qT",
+           info->from_type, info->to_type);
   else
     inform (loc, "  no known conversion for argument %d from %qT to %qT",
            info->n_arg+1, info->from_type, info->to_type);
@@ -3604,7 +3608,7 @@ build_user_type_conversion_1 (tree totype, tree expr, int flags,
          if (!ics)
            {
              cand->viable = 0;
-             cand->reason = arg_conversion_rejection (NULL_TREE, -1,
+             cand->reason = arg_conversion_rejection (NULL_TREE, -2,
                                                       rettype, totype);
            }
          else if (DECL_NONCONVERTING_P (cand->fn)
@@ -3624,7 +3628,7 @@ build_user_type_conversion_1 (tree totype, tree expr, int flags,
            {
              cand->viable = -1;
              cand->reason
-               = bad_arg_conversion_rejection (NULL_TREE, -1,
+               = bad_arg_conversion_rejection (NULL_TREE, -2,
                                                rettype, totype);
            }
          else if (primary_template_instantiation_p (cand->fn)