* cp-tree.h (sufficient_parms_p): Declare new function.
* call.c (sufficient_parms_p): New function, broken out of ...
(add_function_candidate): ... here. Use it.
(add_conv_candidate): Use it.
* decl.c (grok_ctor_properties): Use it.
From-SVN: r38111
+2000-12-07 Nathan Sidwell <nathan@codesourcery.com>
+
+ * cp-tree.h (sufficient_parms_p): Declare new function.
+ * call.c (sufficient_parms_p): New function, broken out of ...
+ (add_function_candidate): ... here. Use it.
+ (add_conv_candidate): Use it.
+ * decl.c (grok_ctor_properties): Use it.
+
2000-12-07 Jakub Jelinek <jakub@redhat.com>
* optimize.c (copy_body_r): Set STMT_IS_FULL_EXPR_P on EXPR_STMT.
return 0;
}
+
+/* Returns non-zero if PARMLIST consists of only default parms and/or
+ ellipsis. */
+
+int
+sufficient_parms_p (parmlist)
+ tree parmlist;
+{
+ for (; parmlist && parmlist != void_list_node;
+ parmlist = TREE_CHAIN (parmlist))
+ if (!TREE_PURPOSE (parmlist))
+ return 0;
+ return 1;
+}
+
static tree
build_conv (code, type, from)
enum tree_code code;
viable = 0;
/* Make sure there are default args for the rest of the parms. */
- else for (; parmnode && parmnode != void_list_node;
- parmnode = TREE_CHAIN (parmnode))
- if (! TREE_PURPOSE (parmnode))
- {
- viable = 0;
- break;
- }
+ else if (!sufficient_parms_p (parmnode))
+ viable = 0;
if (! viable)
goto out;
if (i < len)
viable = 0;
- for (; parmnode && parmnode != void_list_node;
- parmnode = TREE_CHAIN (parmnode))
- if (! TREE_PURPOSE (parmnode))
- {
- viable = 0;
- break;
- }
+ if (!sufficient_parms_p (parmnode))
+ viable = 0;
return add_candidate (candidates, totype, convs, viable);
}
extern tree build_call PARAMS ((tree, tree));
extern tree build_method_call PARAMS ((tree, tree, tree, tree, int));
extern int null_ptr_cst_p PARAMS ((tree));
+extern int sufficient_parms_p PARAMS ((tree));
extern tree type_decays_to PARAMS ((tree));
extern tree build_user_type_conversion PARAMS ((tree, tree, int));
extern tree build_new_function_call PARAMS ((tree, tree));
extern tree binfo_for_vtable PARAMS ((tree));
extern tree binfo_from_vbase PARAMS ((tree));
extern tree dfs_walk PARAMS ((tree,
- tree (*)(tree, void *),
+ tree (*) (tree, void *),
tree (*) (tree, void *),
void *));
extern tree dfs_walk_real PARAMS ((tree,
other parameters have default arguments. */
if (TREE_CODE (parmtype) == REFERENCE_TYPE
&& TYPE_MAIN_VARIANT (TREE_TYPE (parmtype)) == ctype
- && (TREE_CHAIN (parmtypes) == NULL_TREE
- || TREE_CHAIN (parmtypes) == void_list_node
- || TREE_PURPOSE (TREE_CHAIN (parmtypes)))
+ && sufficient_parms_p (TREE_CHAIN (parmtypes))
&& !(DECL_TEMPLATE_INSTANTIATION (decl)
&& is_member_template (DECL_TI_TEMPLATE (decl))))
{
existence. Theoretically, they should never even be
instantiated, but that's hard to forestall. */
else if (TYPE_MAIN_VARIANT (parmtype) == ctype
- && (TREE_CHAIN (parmtypes) == NULL_TREE
- || TREE_CHAIN (parmtypes) == void_list_node
- || TREE_PURPOSE (TREE_CHAIN (parmtypes)))
+ && sufficient_parms_p (TREE_CHAIN (parmtypes))
&& !(DECL_TEMPLATE_INSTANTIATION (decl)
&& is_member_template (DECL_TI_TEMPLATE (decl))))
{