cp-tree.h (sufficient_parms_p): Declare new function.

* 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
This commit is contained in:
Nathan Sidwell 2000-12-07 14:17:53 +00:00 committed by Nathan Sidwell
parent 5eec284733
commit a11d04b523
4 changed files with 31 additions and 21 deletions

View File

@ -1,3 +1,11 @@
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.

View File

@ -589,6 +589,21 @@ null_ptr_cst_p (t)
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;
@ -1324,13 +1339,8 @@ add_function_candidate (candidates, fn, ctype, arglist, flags)
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;
@ -1471,13 +1481,8 @@ add_conv_candidate (candidates, fn, obj, arglist)
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);
}

View File

@ -3736,6 +3736,7 @@ extern tree build_addr_func PARAMS ((tree));
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));
@ -4269,7 +4270,7 @@ extern tree lookup_conversions PARAMS ((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,

View File

@ -12137,9 +12137,7 @@ grok_ctor_properties (ctype, decl)
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))))
{
@ -12163,9 +12161,7 @@ grok_ctor_properties (ctype, 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))))
{