re PR c++/19966 (Misleading message "must take exactly one argument")
2005-03-17 Paolo Carlini <pcarlini@suse.de> PR c++/19966 * cp-tree.h (grok_op_properties): Change return type to void. * decl.c (grok_op_properties): Return early - don't check the arity - in case of a static member or an operator that cannot be non-member; tidy a bit. From-SVN: r96609
This commit is contained in:
parent
3bd62c453d
commit
f2a7915275
@ -1,3 +1,11 @@
|
||||
2005-03-17 Paolo Carlini <pcarlini@suse.de>
|
||||
|
||||
PR c++/19966
|
||||
* cp-tree.h (grok_op_properties): Change return type to void.
|
||||
* decl.c (grok_op_properties): Return early - don't check the
|
||||
arity - in case of a static member or an operator that cannot
|
||||
be non-member; tidy a bit.
|
||||
|
||||
2005-03-17 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
PR c++/20186
|
||||
|
@ -3795,7 +3795,7 @@ extern int copy_fn_p (tree);
|
||||
extern tree get_scope_of_declarator (const cp_declarator *);
|
||||
extern void grok_special_member_properties (tree);
|
||||
extern int grok_ctor_properties (tree, tree);
|
||||
extern bool grok_op_properties (tree, int, bool);
|
||||
extern void grok_op_properties (tree, int, bool);
|
||||
extern tree xref_tag (enum tag_types, tree, tag_scope, bool);
|
||||
extern tree xref_tag_from_type (tree, tree, tag_scope);
|
||||
extern void xref_basetypes (tree, tree);
|
||||
|
@ -8648,11 +8648,10 @@ unary_op_p (enum tree_code code)
|
||||
|| code == TYPE_EXPR);
|
||||
}
|
||||
|
||||
/* DECL is a declaration for an overloaded operator. Returns true if
|
||||
the declaration is valid; false otherwise. If COMPLAIN is true,
|
||||
/* DECL is a declaration for an overloaded operator. If COMPLAIN is true,
|
||||
errors are issued for invalid declarations. */
|
||||
|
||||
bool
|
||||
void
|
||||
grok_op_properties (tree decl, int friendp, bool complain)
|
||||
{
|
||||
tree argtypes = TYPE_ARG_TYPES (TREE_TYPE (decl));
|
||||
@ -8661,10 +8660,6 @@ grok_op_properties (tree decl, int friendp, bool complain)
|
||||
tree name = DECL_NAME (decl);
|
||||
enum tree_code operator_code;
|
||||
int arity;
|
||||
bool ok;
|
||||
|
||||
/* Assume that the declaration is valid. */
|
||||
ok = true;
|
||||
|
||||
/* Count the number of arguments. */
|
||||
for (argtype = argtypes, arity = 0;
|
||||
@ -8762,14 +8757,20 @@ grok_op_properties (tree decl, int friendp, bool complain)
|
||||
|| operator_code == COMPONENT_REF
|
||||
|| operator_code == ARRAY_REF
|
||||
|| operator_code == NOP_EXPR)
|
||||
error ("%qD must be a nonstatic member function", decl);
|
||||
{
|
||||
error ("%qD must be a nonstatic member function", decl);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
tree p;
|
||||
|
||||
if (DECL_STATIC_FUNCTION_P (decl))
|
||||
error ("%qD must be either a non-static member "
|
||||
"function or a non-member function", decl);
|
||||
{
|
||||
error ("%qD must be either a non-static member "
|
||||
"function or a non-member function", decl);
|
||||
return;
|
||||
}
|
||||
|
||||
for (p = argtypes; p && p != void_list_node; p = TREE_CHAIN (p))
|
||||
{
|
||||
@ -8784,12 +8785,11 @@ grok_op_properties (tree decl, int friendp, bool complain)
|
||||
if (!p || p == void_list_node)
|
||||
{
|
||||
if (!complain)
|
||||
return false;
|
||||
return;
|
||||
|
||||
error ("%qD must have an argument of class or "
|
||||
"enumerated type",
|
||||
decl);
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -8797,7 +8797,7 @@ grok_op_properties (tree decl, int friendp, bool complain)
|
||||
/* There are no restrictions on the arguments to an overloaded
|
||||
"operator ()". */
|
||||
if (operator_code == CALL_EXPR)
|
||||
return ok;
|
||||
return;
|
||||
|
||||
if (IDENTIFIER_TYPENAME_P (name) && ! DECL_TEMPLATE_INFO (decl))
|
||||
{
|
||||
@ -8982,7 +8982,6 @@ grok_op_properties (tree decl, int friendp, bool complain)
|
||||
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
/* Return a string giving the keyword associate with CODE. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user