public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Minor C++ PATCH to make unify_invalid a common breakpoint
@ 2017-05-10 20:23 Jason Merrill
  0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2017-05-10 20:23 UTC (permalink / raw)
  To: gcc-patches List

[-- Attachment #1: Type: text/plain, Size: 218 bytes --]

It's periodically been a minor headache that there was no one place I
could set a breakpoint on when exactly deduction fails.  This patch
makes unify_invalid that place.

Tested x86_64-pc-linux-gnu, applying to trunk.

[-- Attachment #2: unify-invalid.diff --]
[-- Type: text/plain, Size: 5760 bytes --]

commit 387302d431ce2d837c947c6893cbcbce1cdd1318
Author: Jason Merrill <jason@redhat.com>
Date:   Wed May 10 12:29:26 2017 -0400

            Have other unify failure functions call unify_invalid.
    
            * pt.c (unify_parameter_deduction_failure, unify_cv_qual_mismatch)
            (unify_type_mismatch, unify_parameter_pack_mismatch)
            (unify_ptrmem_cst_mismatch, unify_expression_unequal)
            (unify_parameter_pack_inconsistent, unify_inconsistency)
            (unify_vla_arg, unify_method_type_error, unify_arity)
            (unify_arg_conversion, unify_no_common_base)
            (unify_inconsistent_template_template_parameters)
            (unify_template_deduction_failure)
            (unify_template_argument_mismatch)
            (unify_overload_resolution_failure): Call unify_invalid.

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 17398c9..f80d7a5 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -6105,19 +6105,22 @@ unify_success (bool /*explain_p*/)
   return 0;
 }
 
+/* Other failure functions should call this one, to provide a single function
+   for setting a breakpoint on.  */
+
+static int
+unify_invalid (bool /*explain_p*/)
+{
+  return 1;
+}
+
 static int
 unify_parameter_deduction_failure (bool explain_p, tree parm)
 {
   if (explain_p)
     inform (input_location,
 	    "  couldn't deduce template parameter %qD", parm);
-  return 1;
-}
-
-static int
-unify_invalid (bool /*explain_p*/)
-{
-  return 1;
+  return unify_invalid (explain_p);
 }
 
 static int
@@ -6127,7 +6130,7 @@ unify_cv_qual_mismatch (bool explain_p, tree parm, tree arg)
     inform (input_location,
 	    "  types %qT and %qT have incompatible cv-qualifiers",
 	    parm, arg);
-  return 1;
+  return unify_invalid (explain_p);
 }
 
 static int
@@ -6135,7 +6138,7 @@ unify_type_mismatch (bool explain_p, tree parm, tree arg)
 {
   if (explain_p)
     inform (input_location, "  mismatched types %qT and %qT", parm, arg);
-  return 1;
+  return unify_invalid (explain_p);
 }
 
 static int
@@ -6146,7 +6149,7 @@ unify_parameter_pack_mismatch (bool explain_p, tree parm, tree arg)
 	    "  template parameter %qD is not a parameter pack, but "
 	    "argument %qD is",
 	    parm, arg);
-  return 1;
+  return unify_invalid (explain_p);
 }
 
 static int
@@ -6157,7 +6160,7 @@ unify_ptrmem_cst_mismatch (bool explain_p, tree parm, tree arg)
 	    "  template argument %qE does not match "
 	    "pointer-to-member constant %qE",
 	    arg, parm);
-  return 1;
+  return unify_invalid (explain_p);
 }
 
 static int
@@ -6165,7 +6168,7 @@ unify_expression_unequal (bool explain_p, tree parm, tree arg)
 {
   if (explain_p)
     inform (input_location, "  %qE is not equivalent to %qE", parm, arg);
-  return 1;
+  return unify_invalid (explain_p);
 }
 
 static int
@@ -6175,7 +6178,7 @@ unify_parameter_pack_inconsistent (bool explain_p, tree old_arg, tree new_arg)
     inform (input_location,
 	    "  inconsistent parameter pack deduction with %qT and %qT",
 	    old_arg, new_arg);
-  return 1;
+  return unify_invalid (explain_p);
 }
 
 static int
@@ -6192,7 +6195,7 @@ unify_inconsistency (bool explain_p, tree parm, tree first, tree second)
 		"  deduced conflicting values for non-type parameter "
 		"%qE (%qE and %qE)", parm, first, second);
     }
-  return 1;
+  return unify_invalid (explain_p);
 }
 
 static int
@@ -6203,7 +6206,7 @@ unify_vla_arg (bool explain_p, tree arg)
 	    "  variable-sized array type %qT is not "
 	    "a valid template argument",
 	    arg);
-  return 1;
+  return unify_invalid (explain_p);
 }
 
 static int
@@ -6213,7 +6216,7 @@ unify_method_type_error (bool explain_p, tree arg)
     inform (input_location,
 	    "  member function type %qT is not a valid template argument",
 	    arg);
-  return 1;
+  return unify_invalid (explain_p);
 }
 
 static int
@@ -6232,7 +6235,7 @@ unify_arity (bool explain_p, int have, int wanted, bool least_p = false)
 		  "  candidate expects %d arguments, %d provided",
 		  wanted, have);
     }
-  return 1;
+  return unify_invalid (explain_p);
 }
 
 static int
@@ -6256,7 +6259,7 @@ unify_arg_conversion (bool explain_p, tree to_type,
     inform (EXPR_LOC_OR_LOC (arg, input_location),
 	    "  cannot convert %qE (type %qT) to type %qT",
 	    arg, from_type, to_type);
-  return 1;
+  return unify_invalid (explain_p);
 }
 
 static int
@@ -6274,7 +6277,7 @@ unify_no_common_base (bool explain_p, enum template_base_result r,
 	inform (input_location, "  %qT is not derived from %qT", arg, parm);
 	break;
       }
-  return 1;
+  return unify_invalid (explain_p);
 }
 
 static int
@@ -6284,7 +6287,7 @@ unify_inconsistent_template_template_parameters (bool explain_p)
     inform (input_location,
 	    "  template parameters of a template template argument are "
 	    "inconsistent with other deduced template arguments");
-  return 1;
+  return unify_invalid (explain_p);
 }
 
 static int
@@ -6294,7 +6297,7 @@ unify_template_deduction_failure (bool explain_p, tree parm, tree arg)
     inform (input_location,
 	    "  can't deduce a template for %qT from non-template type %qT",
 	    parm, arg);
-  return 1;
+  return unify_invalid (explain_p);
 }
 
 static int
@@ -6303,7 +6306,7 @@ unify_template_argument_mismatch (bool explain_p, tree parm, tree arg)
   if (explain_p)
     inform (input_location,
 	    "  template argument %qE does not match %qE", arg, parm);
-  return 1;
+  return unify_invalid (explain_p);
 }
 
 static int
@@ -6313,7 +6316,7 @@ unify_overload_resolution_failure (bool explain_p, tree arg)
     inform (input_location,
 	    "  could not resolve address from overloaded function %qE",
 	    arg);
-  return 1;
+  return unify_invalid (explain_p);
 }
 
 /* Attempt to convert the non-type template parameter EXPR to the

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-05-10 20:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-10 20:23 Minor C++ PATCH to make unify_invalid a common breakpoint Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).