diff mbox

[C++] Use default arguments in one more place

Message ID 56713F6E.2080508@oracle.com
State New
Headers show

Commit Message

Paolo Carlini Dec. 16, 2015, 10:39 a.m. UTC
Hi,

while looking into a few small issues I noticed that we could use C++ 
defaults here too. Tested x86_64-linux.

Thanks,
Paolo.

///////////////////

2015-12-16  Paolo Carlini  <paolo.carlini@oracle.com>

	* pt.c (comp_template_args): Remove.
	(comp_template_args_with_info): Rename to comp_template_args;
	not static.
	(add_pending_template): Adjust call.
	* cp-tree.h (comp_template_args): Add default arguments.

Comments

Jason Merrill Dec. 16, 2015, 3:44 p.m. UTC | #1
OK.

Jason
diff mbox

Patch

Index: cp-tree.h
===================================================================
--- cp-tree.h	(revision 231672)
+++ cp-tree.h	(working copy)
@@ -6115,7 +6115,8 @@  extern int template_class_depth			(tree);
 extern int is_specialization_of			(tree, tree);
 extern bool is_specialization_of_friend		(tree, tree);
 extern tree get_pattern_parm			(tree, tree);
-extern int comp_template_args			(tree, tree);
+extern int comp_template_args			(tree, tree, tree * = NULL,
+						 tree * = NULL);
 extern tree maybe_process_partial_specialization (tree);
 extern tree most_specialized_instantiation	(tree);
 extern void print_candidates			(tree);
Index: pt.c
===================================================================
--- pt.c	(revision 231672)
+++ pt.c	(working copy)
@@ -7881,9 +7881,9 @@  template_args_equal (tree ot, tree nt)
    template arguments.  Returns 0 otherwise, and updates OLDARG_PTR and
    NEWARG_PTR with the offending arguments if they are non-NULL.  */
 
-static int
-comp_template_args_with_info (tree oldargs, tree newargs,
-			      tree *oldarg_ptr, tree *newarg_ptr)
+int
+comp_template_args (tree oldargs, tree newargs,
+		    tree *oldarg_ptr, tree *newarg_ptr)
 {
   int i;
 
@@ -7913,15 +7913,6 @@  template_args_equal (tree ot, tree nt)
   return 1;
 }
 
-/* Returns 1 iff the OLDARGS and NEWARGS are in fact identical sets
-   of template arguments.  Returns 0 otherwise.  */
-
-int
-comp_template_args (tree oldargs, tree newargs)
-{
-  return comp_template_args_with_info (oldargs, newargs, NULL, NULL);
-}
-
 static void
 add_pending_template (tree d)
 {
@@ -19048,8 +19039,8 @@  unify_pack_expansion (tree tparms, tree targs, tre
 	  tree bad_old_arg = NULL_TREE, bad_new_arg = NULL_TREE;
 	  tree old_args = ARGUMENT_PACK_ARGS (old_pack);
 
-	  if (!comp_template_args_with_info (old_args, new_args,
-					     &bad_old_arg, &bad_new_arg))
+	  if (!comp_template_args (old_args, new_args,
+				   &bad_old_arg, &bad_new_arg))
 	    /* Inconsistent unification of this parameter pack.  */
 	    return unify_parameter_pack_inconsistent (explain_p,
 						      bad_old_arg,